amazon-ion / ion-hive-serde

A Apache Hive SerDe (short for serializer/deserializer) for the Ion file format.
Apache License 2.0
28 stars 12 forks source link

IonTimestampLite cannot be cast to com.amazon.ion.IonText #78

Closed cheqianh closed 2 years ago

cheqianh commented 2 years ago

When create a hive table, it raises an error if assign a Hive String field some Ion value (e.g. Ion timestamp, Ion integer). For example,

CREATE EXTERNAL TABLE `test`(`starttime` string)
ROW FORMAT SERDE  'com.amazon.ionhiveserde.IonHiveSerDe' 
STORED AS INPUTFORMAT 'com.amazon.ionhiveserde.formats.IonInputFormat' 
OUTPUTFORMAT 'com.amazon.ionhiveserde.formats.IonOutputFormat'

and the Ion file is:

{starttime: 2020-11-05T07:18:59.968Z}

it throw an exception:

Failed with exception java.io.IOException:org.apache.hadoop.hive.ql.metadata.HiveException: java.lang.ClassCastException: com.amazon.ion.impl.lite.IonTimestampLite cannot be cast to com.amazon.ion.IonText