[ 
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.

CREATE EXTERNAL TABLE gk_test(`id` int,`name` string,`dt` timestamp)STORED AS 
PARQUET;

insert into gk_test values (1, "test name" , cast('2024-08-09 14:08:26.326107' 
as timestamp));

select * from gk_test;

ALTER TABLE gk_test SET TBLPROPERTIES 
('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler', 
'format-version' = '2');

select * from gk_test;

 

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}

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

 

Below are the steps to reproduce the issue.


CREATE EXTERNAL TABLE gk_test(`id` int,`name` string,`dt` timestamp)STORED AS 
PARQUET;

insert into gk_test values (1, "test name" , cast('2024-08-09 14:08:26.326107' 
as timestamp));

select * from gk_test;

ALTER TABLE gk_test SET TBLPROPERTIES 
('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler', 
'format-version' = '2');

select * from gk_test;

 

ERROR
{noformat}
See ./ql/target/tmp/log/hive.log or ./itests/qtest/target/tmp/log/hive.log, or 
check ./ql/target/surefire-reports or ./itests/qtest/target/surefire-reports/ 
for specific test cases logs. java.lang.RuntimeException: 
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.FetchTask.executeInner(FetchTask.java:210) at 
org.apache.hadoop.hive.ql.exec.FetchTask.execute(FetchTask.java:95) at 
org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:201) at 
org.apache.hadoop.hive.ql.Driver.run(Driver.java:142) at 
org.apache.hadoop.hive.ql.Driver.run(Driver.java:137) at 
org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:185) at 
org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:230) at 
org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:257) at 
org.apache.hadoop.hive.cli.CliDriver.processCmd1(CliDriver.java:201) at 
org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:127) at 
org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:425) at 
org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:356) at 
org.apache.hadoop.hive.ql.QTestUtil.executeClientInternal(QTestUtil.java:732) 
at org.apache.hadoop.hive.ql.QTestUtil.executeClient(QTestUtil.java:702) at 
org.apache.hadoop.hive.cli.control.CoreCliDriver.runTest(CoreCliDriver.java:116)
 at org.apache.hadoop.hive.cli.control.CliAdapter.runTest(CliAdapter.java:157) 
at 
org.apache.hadoop.hive.cli.TestIcebergCliDriver.testCliDriver(TestIcebergCliDriver.java:61)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:498) at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
 at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
 at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
 at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
 at 
org.apache.hadoop.hive.cli.control.CliAdapter$2$1.evaluate(CliAdapter.java:135) 
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at 
org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
 at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
 at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
 at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at 
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at 
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at 
org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at 
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at 
org.junit.runners.ParentRunner.run(ParentRunner.java:413) at 
org.junit.runners.Suite.runChild(Suite.java:128) at 
org.junit.runners.Suite.runChild(Suite.java:27) at 
org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at 
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at 
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at 
org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at 
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at 
org.apache.hadoop.hive.cli.control.CliAdapter$1$1.evaluate(CliAdapter.java:95) 
at org.junit.rules.RunRules.evaluate(RunRules.java:20) at 
org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at 
org.junit.runners.ParentRunner.run(ParentRunner.java:413) at 
org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
 at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
 at 
org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
 at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) 
at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:377)
 at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:138) at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465) at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451) 
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.
> CREATE EXTERNAL TABLE gk_test(`id` int,`name` string,`dt` timestamp)STORED AS 
> PARQUET;
> insert into gk_test values (1, "test name" , cast('2024-08-09 
> 14:08:26.326107' as timestamp));
> select * from gk_test;
> ALTER TABLE gk_test SET TBLPROPERTIES 
> ('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler', 
> 'format-version' = '2');
> select * from gk_test;
>  
> 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}



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

Reply via email to