deniskuzZ commented on code in PR #5123:
URL: https://github.com/apache/hive/pull/5123#discussion_r1575777876
##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java:
##########
@@ -1915,6 +1917,46 @@ private boolean hasUndergonePartitionEvolution(Table
table) {
.anyMatch(id -> id < table.spec().specId());
}
+ private boolean
isIdentityPartitionTable(org.apache.hadoop.hive.ql.metadata.Table table) {
+ return
getPartitionTransformSpec(table).stream().map(TransformSpec::getTransformType)
+ .allMatch(type -> type == TransformSpec.TransformType.IDENTITY);
+ }
+
+ @Override
+ public org.apache.commons.lang3.tuple.Pair<Boolean, ErrorMsg>
isEligibleForCompaction(
+ org.apache.hadoop.hive.ql.metadata.Table table, Map<String, String>
partitionSpec) {
+ if (partitionSpec != null) {
+ Table icebergTable = IcebergTableUtil.getTable(conf, table.getTTable());
+ if (hasUndergonePartitionEvolution(icebergTable)) {
+ return org.apache.commons.lang3.tuple.Pair.of(false,
ErrorMsg.COMPACTION_PARTITION_EVOLUTION);
+ }
+ if (!isIdentityPartitionTable(table)) {
+ return org.apache.commons.lang3.tuple.Pair.of(false,
ErrorMsg.COMPACTION_NON_IDENTITY_PARTITION_SPEC);
+ }
+ }
+ return org.apache.commons.lang3.tuple.Pair.of(true, null);
+ }
+
+ @Override
+ public List<Partition>
getPartitions(org.apache.hadoop.hive.ql.metadata.Table table,
+ Map<String, String> partitionSpec, short limit) throws SemanticException
{
+ return table.getStorageHandler().getPartitionNames(table,
partitionSpec).stream()
Review Comment:
why do you need `table.getStorageHandler()`, call `getPartitionNames`
directly
--
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]