diff --git a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java index 377500f81a69b..185c1c25c2147 100644 --- a/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java +++ b/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergUtil.java @@ -411,12 +411,22 @@ public static List toHiveColumns(List columns) return columns.stream() .map(column -> new Column( column.name(), - HiveType.toHiveType(HiveSchemaUtil.convert(column.type())), + icebergTypeToHiveType(column.type()), Optional.empty(), Optional.empty())) .collect(toImmutableList()); } + private static HiveType icebergTypeToHiveType(org.apache.iceberg.types.Type icebergType) + { + // Special handling for TIME type: use bigint instead of 'string' + if (icebergType.typeId() == org.apache.iceberg.types.Type.TypeID.TIME) { + return HiveType.HIVE_LONG; + } + + return HiveType.toHiveType(HiveSchemaUtil.convert(icebergType)); + } + public static FileFormat getFileFormat(Table table) { return FileFormat.valueOf(table.properties()