[ 
https://issues.apache.org/jira/browse/HIVE-28518?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]
Gopinath updated HIVE-28518:
----------------------------
    Description: 
Hive in-place migration to iceberg fails when there is a timestamp column

Below are the steps to reproduce the issue.
{noformat}
CREATE EXTERNAL TABLE test(`id` int,`name` string,`dt` timestamp)STORED AS 
PARQUET;
insert into test values (1, "test name" , cast('2024-08-09 14:08:26.326107' as 
timestamp));
select * from test;
ALTER TABLE test SET TBLPROPERTIES 
('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler', 
'format-version' = '2');
select * from test;
{noformat}
Stack Trace - 
{noformat}
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: 
java.lang.ClassCastException: java.time.OffsetDateTime cannot be cast to 
java.time.LocalDateTime
        at 
org.apache.hadoop.hive.ql.exec.ListSinkOperator.process(ListSinkOperator.java:98)
        at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:888)
        at 
org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator.java:94)
        at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:888)
        at 
org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOperator.java:173)
        at 
org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:545)
        at 
org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:537)
        at 
org.apache.hadoop.hive.ql.exec.FetchTask.executeInner(FetchTask.java:194)
        ... 55 more
Caused by: java.lang.ClassCastException: java.time.OffsetDateTime cannot be 
cast to java.time.LocalDateTime
        at 
org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspectorHive3.getPrimitiveJavaObject(IcebergTimestampObjectInspectorHive3.java:58)
        at 
org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspectorHive3.getPrimitiveWritableObject(IcebergTimestampObjectInspectorHive3.java:64)
        at 
org.apache.hadoop.hive.serde2.lazy.LazyUtils.writePrimitiveUTF8(LazyUtils.java:308)
        at 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.serialize(LazySimpleSerDe.java:308)
        at 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.serializeField(LazySimpleSerDe.java:263)
        at 
org.apache.hadoop.hive.serde2.DelimitedJSONSerDe.serializeField(DelimitedJSONSerDe.java:72)
        at 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.doSerialize(LazySimpleSerDe.java:247)
        at 
org.apache.hadoop.hive.serde2.AbstractEncodingAwareSerDe.serialize(AbstractEncodingAwareSerDe.java:53)
        at 
org.apache.hadoop.hive.serde2.DefaultFetchFormatter.convert(DefaultFetchFormatter.java:67)
        at 
org.apache.hadoop.hive.serde2.DefaultFetchFormatter.convert(DefaultFetchFormatter.java:36)
        at 
org.apache.hadoop.hive.ql.exec.ListSinkOperator.process(ListSinkOperator.java:94)
        ... 62 more{noformat}

  was:
Hive in-place migration to iceberg fails when there is a timestamp column

 

Below are the steps to reproduce the issue.



 
{noformat}
CREATE EXTERNAL TABLE test(`id` int,`name` string,`dt` timestamp)STORED AS 
PARQUET;
insert into test values (1, "test name" , cast('2024-08-09 14:08:26.326107' as 
timestamp));
select * from test;
ALTER TABLE test SET TBLPROPERTIES 
('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler', 
'format-version' = '2');
select * from test;
{noformat}
 

 

ERROR
{noformat}
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: 
java.lang.ClassCastException: java.time.OffsetDateTime cannot be cast to 
java.time.LocalDateTime
        at 
org.apache.hadoop.hive.ql.exec.ListSinkOperator.process(ListSinkOperator.java:98)
        at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:888)
        at 
org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator.java:94)
        at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:888)
        at 
org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOperator.java:173)
        at 
org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:545)
        at 
org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:537)
        at 
org.apache.hadoop.hive.ql.exec.FetchTask.executeInner(FetchTask.java:194)
        ... 55 more
Caused by: java.lang.ClassCastException: java.time.OffsetDateTime cannot be 
cast to java.time.LocalDateTime
        at 
org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspectorHive3.getPrimitiveJavaObject(IcebergTimestampObjectInspectorHive3.java:58)
        at 
org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspectorHive3.getPrimitiveWritableObject(IcebergTimestampObjectInspectorHive3.java:64)
        at 
org.apache.hadoop.hive.serde2.lazy.LazyUtils.writePrimitiveUTF8(LazyUtils.java:308)
        at 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.serialize(LazySimpleSerDe.java:308)
        at 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.serializeField(LazySimpleSerDe.java:263)
        at 
org.apache.hadoop.hive.serde2.DelimitedJSONSerDe.serializeField(DelimitedJSONSerDe.java:72)
        at 
org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.doSerialize(LazySimpleSerDe.java:247)
        at 
org.apache.hadoop.hive.serde2.AbstractEncodingAwareSerDe.serialize(AbstractEncodingAwareSerDe.java:53)
        at 
org.apache.hadoop.hive.serde2.DefaultFetchFormatter.convert(DefaultFetchFormatter.java:67)
        at 
org.apache.hadoop.hive.serde2.DefaultFetchFormatter.convert(DefaultFetchFormatter.java:36)
        at 
org.apache.hadoop.hive.ql.exec.ListSinkOperator.process(ListSinkOperator.java:94)
        ... 62 more{noformat}


> Hive in-place migration to iceberg fails when there is a timestamp column
> -------------------------------------------------------------------------
>
>                 Key: HIVE-28518
>                 URL: https://issues.apache.org/jira/browse/HIVE-28518
>             Project: Hive
>          Issue Type: Bug
>            Reporter: sachin
>            Priority: Major
>
> Hive in-place migration to iceberg fails when there is a timestamp column
> Below are the steps to reproduce the issue.
> {noformat}
> CREATE EXTERNAL TABLE test(`id` int,`name` string,`dt` timestamp)STORED AS 
> PARQUET;
> insert into test values (1, "test name" , cast('2024-08-09 14:08:26.326107' 
> as timestamp));
> select * from test;
> ALTER TABLE test SET TBLPROPERTIES 
> ('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler', 
> 'format-version' = '2');
> select * from test;
> {noformat}
> Stack Trace - 
> {noformat}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: 
> java.lang.ClassCastException: java.time.OffsetDateTime cannot be cast to 
> java.time.LocalDateTime
>       at 
> org.apache.hadoop.hive.ql.exec.ListSinkOperator.process(ListSinkOperator.java:98)
>       at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:888)
>       at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.process(SelectOperator.java:94)
>       at org.apache.hadoop.hive.ql.exec.Operator.forward(Operator.java:888)
>       at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.process(TableScanOperator.java:173)
>       at 
> org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:545)
>       at 
> org.apache.hadoop.hive.ql.exec.FetchOperator.pushRow(FetchOperator.java:537)
>       at 
> org.apache.hadoop.hive.ql.exec.FetchTask.executeInner(FetchTask.java:194)
>       ... 55 more
> Caused by: java.lang.ClassCastException: java.time.OffsetDateTime cannot be 
> cast to java.time.LocalDateTime
>       at 
> org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspectorHive3.getPrimitiveJavaObject(IcebergTimestampObjectInspectorHive3.java:58)
>       at 
> org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspectorHive3.getPrimitiveWritableObject(IcebergTimestampObjectInspectorHive3.java:64)
>       at 
> org.apache.hadoop.hive.serde2.lazy.LazyUtils.writePrimitiveUTF8(LazyUtils.java:308)
>       at 
> org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.serialize(LazySimpleSerDe.java:308)
>       at 
> org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.serializeField(LazySimpleSerDe.java:263)
>       at 
> org.apache.hadoop.hive.serde2.DelimitedJSONSerDe.serializeField(DelimitedJSONSerDe.java:72)
>       at 
> org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe.doSerialize(LazySimpleSerDe.java:247)
>       at 
> org.apache.hadoop.hive.serde2.AbstractEncodingAwareSerDe.serialize(AbstractEncodingAwareSerDe.java:53)
>       at 
> org.apache.hadoop.hive.serde2.DefaultFetchFormatter.convert(DefaultFetchFormatter.java:67)
>       at 
> org.apache.hadoop.hive.serde2.DefaultFetchFormatter.convert(DefaultFetchFormatter.java:36)
>       at 
> org.apache.hadoop.hive.ql.exec.ListSinkOperator.process(ListSinkOperator.java:94)
>       ... 62 more{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to