RussellSpitzer opened a new issue #2245:
URL: https://github.com/apache/iceberg/issues/2245


   A user was attempting to convert an ORC backed external table in hive to a 
Iceberg table using the migrate command but was immediately met with a "Can not 
promote TIMESTAMP to TIMESTAMP" error. This occurs because our Spark -> Iceberg 
conversion code always converts to a Timestamp.withZone.
   
   
   This is pretty easy to reproduce with
   ```scala
   spark.sql("CREATE EXTERNAL TABLE mytable (foo timestamp) STORED AS orc 
LOCATION '/Users/russellspitzer/Temp/foo'")

   spark.sql("INSERT INTO mytable VALUES (now())")
   
spark.sql("CALL spark_catalog.system.migrate('mytable')")

   
spark.sql("SELECT * FROM mytable")
   ```
   
   ```
   java.lang.IllegalArgumentException: Can not promote TIMESTAMP type to 
TIMESTAMP
        at 
org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkArgument(Preconditions.java:441)
        at 
org.apache.iceberg.orc.ORCSchemaUtil.buildOrcProjection(ORCSchemaUtil.java:301)
        at 
org.apache.iceberg.orc.ORCSchemaUtil.buildOrcProjection(ORCSchemaUtil.java:275)
        at 
org.apache.iceberg.orc.ORCSchemaUtil.buildOrcProjection(ORCSchemaUtil.java:258)
   ```
   
   I attempted to to just modify the Iceberg table so that it correctly typed 
the columns as Timestamp.withoutZone() but this leads to 
https://github.com/apache/iceberg/issues/2244
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to