Not able to retrieve date values in hive

3149
0
04-22-2016 01:03 AM
SrinivasSanthanam
New Contributor

Hi,

I am having problem related to NULL values on date column after querying in HIVE.

Procedure

Our aim is to transfer the feature classes from a geodatabase and copy it to HDFS using hadoop toolbox for esri. So the steps are we create a json file using features to json and then create a table in hive using the create . Then we copy it to hdfs and then start querying on hive to retrieve the field values.

Problems I am facing

I am having issue with the date fields as mentioned in the screenshots. While creating a table I tried using date as the data type in one create statement and string as the data type in another create statement .

In the former statement after copying to hdfs and while querying, i am unable to retrieve any values and it shows      Failed with exception java.io.IOException:java.lang.ClassCastException: org.apache.hadoop.hive.serde2.io.DateWritable cannot be cast to org.apache.hadoop.io.Text.

In the latter statement when I used string as the datatype, it shows some random values as expected and when i tried to typecast the date column as date I am getting null values.

I have attached the two screenshots which contains the script and the results with the associated errors. The date error png is the one with date as datatype and date string bhuj is the one with string as datatype. Kindly help me with this issue as I am not able to proceed further in my attempt to migrating the feature classes to hadoop

0 Kudos
0 Replies