Reputation: 23
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;
Upvotes: 2
Views: 8893
Reputation: 3325
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.
Upvotes: 0
Reputation: 11274
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.
Upvotes: 2