Skip to content

Commit

Permalink
Bump Iceberg version to 0.8.0-incubating
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lxynov authored and electrum committed Jul 10, 2020
1 parent 32c4f1a commit 7d1e7e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion presto-iceberg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<properties>
<air.main.basedir>${project.parent.basedir}</air.main.basedir>
<dep.iceberg.version>0.7.0-incubating</dep.iceberg.version>
<dep.iceberg.version>0.8.0-incubating</dep.iceberg.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -563,9 +564,10 @@ private static Schema toIcebergSchema(List<ColumnMetadata> 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
Expand Down

0 comments on commit 7d1e7e5

Please sign in to comment.