1
votes

Everytime I am trying to select in IMPALA a DATE type field from a table created in HIVE I get the AnalysisException: Unsupported type 'DATE'.

Are there any workarounds?

UPDATE this is an example of a create table schema from hive and an impala query

Schema:

CREATE TABLE myschema.mytable(day_dt date, event string)

PARTITIONED BY (day_id int)

STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat'

OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'

Impala query select b.day_dt from myschema.mytable b;

2
Consider using TIMESTAMP data type for better interoperability - Bala
The hive table I am trying to query is already created and cannot be altered. Any solution for working with the current schema in impala? - Paul Mihai Stolniceanu

2 Answers

1
votes

Impala doesn't have a DATE datatype, whereas Hive has. You will get AnalysisException: Unsupported type 'DATE' when you access it from Impala. A quick fix would be to create a string column of that date value in Hive and access it in whichever way you want from Impala.

0
votes

If you're storing as strings, it may work to create a new external hive table that points to the same HDFS location as the existing table, but with the schema having day_dt with datatype STRING instead of DATE.

This is a true workaround, it may only suit some use cases, and you'd at least need to do "MSCK REPAIR" on the external hive table whenever a new partition is added.