CTAS failing when creating from a view with error "Unsupported type 'null_type'" in impala after upgrading CDH 5.10

0 votes
0 views
asked Aug 28, 2017 in Hadoop by admin (4,410 points)
Summary

Symptoms

Enable to create the impala table with null column in the CDH5.8 and CDH5.9 accordingly:
in CDH5.8/5.9

create table null_test stored as parquet as
(
select
cast( null as decimal(10,0)) as null_col
);
Query: create table null_test stored as parquet as
(
select
cast( null as decimal(10,0)) as null_col
)
+-------------------+
| summary           |
+-------------------+
| Inserted 1 row(s) |
+-------------------+
Fetched 1 row(s) in 1.63s


But we can't create this table in CDH5.10 accordingly:
in CDH5.10

> create table t1_nul_tst as select * from v1_nul_tst where 1=2;
Query: create table t1_nul_tst as select * from v1_nul_tst where 1=2
Query submitted at: 2017-03-27 15:21:55 (Coordinator: http://host-10-17-80-137:25000)
ERROR: AnalysisException: Unsupported type 'null_type' in column 'col1' of table 't1_nul_tst'
CAUSED BY: TableLoadingException: Unsupported type 'null_type' in column 'col1' of table 't1_nul_tst'

Applies To
Cause

This issue is an known issue - the upstream JIRA(IMPALA-5145) and internal JIRA(CDH-52085,CDH-53189) for this issue.- [1]

These JIRA also have the error log like this:
> create table t1_nul_tst as select * from v1_nul_tst where 1=2;
Query: create table t1_nul_tst as select * from v1_nul_tst where 1=2
Query submitted at: 2017-03-27 15:21:55 (Coordinator: http://host-10-17-80-137:25000)
ERROR: AnalysisException: Unsupported type 'null_type' in column 'col1' of table 't1_nul_tst'
CAUSED BY: TableLoadingException: Unsupported type 'null_type' in column 'col1' of table 't1_nul_tst'

[1] -
https://issues.apache.org/jira/browse/IMPALA-5145

 

Instructions

There is a workaround for this issue accordingly:

For the session level
in impala-shell:

> "set enable_expr_rewrites=false;"
> <running the query>


For all system-side:

A. CM > Impala service > Configruation > Search "default_query_options"
B. Please put "enable_expr_rewrites=false" in default_query_options
C. Please Save and restart the impala service


Here is an example for the session level:

> set enable_expr_rewrites=false;
ENABLE_EXPR_REWRITES set to false
> create table null_test stored as parquet as
(
select
cast( null as decimal(10,0)) as null_col
);
Query: create table null_test stored as parquet as
(
select
cast( null as decimal(10,0)) as null_col
)
Query submitted at: 2017-04-11 06:15:16 (Coordinator: http://host-10-17-80-137:25000)
Query progress can be monitored at: http://host-10-17-80-137:25000/query_plan?query_id=164d06bb7298dc42:879f81f200000000
+-------------------+
| summary |
+-------------------+
| Inserted 1 row(s) |
+-------------------+
Fetched 1 row(s) in 0.87s

s

Please log in or register to answer this question.

...