kamaljit-1991 opened a new issue, #6122: URL: https://github.com/apache/iceberg/issues/6122
### Apache Iceberg version 0.13.1 ### Query engine _No response_ ### Please describe the bug 🐞 It is little bit of related https://github.com/apache/iceberg/issues/4523 but not quite. When the order of the columns don't match between the underlying parquet files and the table schema then the IcebergGenerics doesn't work properly while querying the table. But Athena works perfectly fine and ideally it should work too. **Steps to reproduce:** Create a glue table with the following order of columns : <img width="386" alt="image" src="https://user-images.githubusercontent.com/45392269/199949629-79a2a3f3-c2b8-4384-91c2-92e9afae1cb9.png"> And then put the data as the following order in 2 parquet files : ``` required int32 id; optional binary name (STRING); optional double double_col; optional int64 timestamp_col (TIMESTAMP(MICROS,true)); optional int64 _fivetran_synced (TIMESTAMP(MICROS,true)); ``` Another file could be : ``` optional int64 _fivetran_synced (TIMESTAMP(MICROS,false)); optional binary name (STRING); optional int64 timestamp_col (TIMESTAMP(MICROS,false)); optional int32 id (INTEGER(32,true)); optional double double_col; ``` Then if you try to get the records as following : Iterable<Record> records = IcebergGenerics.read(table).build(); for(Record record : records) { System.out.println(((GenericRecord) record).getField("name")); } It will fail with below exception : ``` class org.apache.iceberg.types.Types$IntegerType cannot be cast to class org.apache.iceberg.types.Types$TimestampType (org.apache.iceberg.types.Types$IntegerType and org.apache.iceberg.types.Types$TimestampType are in unnamed module of loader 'app') ``` Any record from the first parquet file will fail because that doesn't match the order of columns with the table and it is trying to convert the name to timestamp. Somehow the `namesToCol` is not working properly. [data.zip](https://github.com/apache/iceberg/files/9937291/data.zip) I uploaded the zip containing 3 parquet files which you could use in an iceberg table to test it. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
