deniskuzZ commented on code in PR #5995: URL: https://github.com/apache/hive/pull/5995#discussion_r2259705572
########## iceberg/iceberg-catalog/pom.xml: ########## @@ -69,7 +69,6 @@ <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-exec</artifactId> - <scope>test</scope> Review Comment: you do not need `SessionStateUtil` here at all ```` List<TransformSpec> partitionBy = PartitionTransform.getPartitionTransformSpec(table.getPartitionKeys()); org.apache.iceberg.PartitionSpec partitionSpec = SchemaUtils.createPartitionSpec(schema, partitionBy) restCatalog.buildTable(TableIdentifier.of(table.getDbName(), table.getTableName()), schema) .withPartitionSpec(partitionSpec) ```` SchemaUtils ```` public PartitionSpec createPartitionSpec(Schema schema, List<TransformSpec> partitionBy) { if (partitionBy.isEmpty()) { return PartitionSpec.unpartitioned(); } PartitionSpec.Builder builder = PartitionSpec.builderFor(schema); partitionBy.forEach(spec -> { switch (spec.getTransformType()) { case IDENTITY: builder.identity(spec.getColumnName().toLowerCase()); break; case YEAR: builder.year(spec.getColumnName()); break; case MONTH: builder.month(spec.getColumnName()); break; case DAY: builder.day(spec.getColumnName()); break; case HOUR: builder.hour(spec.getColumnName()); break; case TRUNCATE: builder.truncate(spec.getColumnName(), spec.getTransformParam()); break; case BUCKET: builder.bucket(spec.getColumnName(), spec.getTransformParam()); break; } }); return builder.build(); } ```` ########## iceberg/iceberg-catalog/pom.xml: ########## @@ -69,7 +69,6 @@ <dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-exec</artifactId> - <scope>test</scope> Review Comment: you do not need `SessionStateUtil` here at all ```` List<TransformSpec> partitionBy = PartitionTransform.getPartitionTransformSpec(table.getPartitionKeys()); org.apache.iceberg.PartitionSpec partitionSpec = SchemaUtils.createPartitionSpec(schema, partitionBy); restCatalog.buildTable(TableIdentifier.of(table.getDbName(), table.getTableName()), schema) .withPartitionSpec(partitionSpec) ```` SchemaUtils ```` public PartitionSpec createPartitionSpec(Schema schema, List<TransformSpec> partitionBy) { if (partitionBy.isEmpty()) { return PartitionSpec.unpartitioned(); } PartitionSpec.Builder builder = PartitionSpec.builderFor(schema); partitionBy.forEach(spec -> { switch (spec.getTransformType()) { case IDENTITY: builder.identity(spec.getColumnName().toLowerCase()); break; case YEAR: builder.year(spec.getColumnName()); break; case MONTH: builder.month(spec.getColumnName()); break; case DAY: builder.day(spec.getColumnName()); break; case HOUR: builder.hour(spec.getColumnName()); break; case TRUNCATE: builder.truncate(spec.getColumnName(), spec.getTransformParam()); break; case BUCKET: builder.bucket(spec.getColumnName(), spec.getTransformParam()); break; } }); return builder.build(); } ```` -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org