From 7d1e7e5dfb9692b6a74e7a93cbc20ee572c5d63e Mon Sep 17 00:00:00 2001 From: Xingyuan Lin Date: Wed, 1 Jul 2020 17:08:00 -0700 Subject: [PATCH] Bump Iceberg version to 0.8.0-incubating The change in IcebergMetadata::toIcebergSchema is needed to avoid failures with nested types. With 0.8.0-incubating, we need to assign fresh IDs (to avoid duplicate IDs) before constructing an Iceberg schema. --- presto-iceberg/pom.xml | 2 +- .../java/io/prestosql/plugin/iceberg/IcebergMetadata.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/presto-iceberg/pom.xml b/presto-iceberg/pom.xml index a728b203372a..2f15c9b892a5 100644 --- a/presto-iceberg/pom.xml +++ b/presto-iceberg/pom.xml @@ -14,7 +14,7 @@ ${project.parent.basedir} - 0.7.0-incubating + 0.8.0-incubating diff --git a/presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/IcebergMetadata.java b/presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/IcebergMetadata.java index c896e7857d2f..c2581ce9386e 100644 --- a/presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/IcebergMetadata.java +++ b/presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/IcebergMetadata.java @@ -70,6 +70,7 @@ import org.apache.iceberg.hadoop.HadoopInputFile; import org.apache.iceberg.types.Type; import org.apache.iceberg.types.TypeUtil; +import org.apache.iceberg.types.Types; import org.apache.iceberg.types.Types.NestedField; import java.io.IOException; @@ -563,9 +564,10 @@ private static Schema toIcebergSchema(List columns) icebergColumns.add(field); } } - Schema schema = new Schema(icebergColumns); + Type icebergSchema = Types.StructType.of(icebergColumns); AtomicInteger nextFieldId = new AtomicInteger(1); - return TypeUtil.assignFreshIds(schema, nextFieldId::getAndIncrement); + icebergSchema = TypeUtil.assignFreshIds(icebergSchema, nextFieldId::getAndIncrement); + return new Schema(icebergSchema.asStructType().fields()); } @Override