deniskuzZ commented on code in PR #6090:
URL: https://github.com/apache/hive/pull/6090#discussion_r2378657359


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveTableUtil.java:
##########
@@ -171,11 +172,13 @@ public static void appendFiles(URI fromURI, String 
format, Table icebergTbl, boo
       if (isOverwrite) {
         DeleteFiles delete = transaction.newDelete();
         if (partitionSpec != null) {
+          Expression andResult = Expressions.alwaysTrue();

Review Comment:
   would be nice to apply small refactor and remove redundant stuff
   ````
   public static Expression generateExpressionFromPartitionSpec(Table table, 
Map<String, String> partitionSpec,
       boolean latestSpecOnly) throws SemanticException {
     Map<String, PartitionField> partitionFieldMap = getPartitionFields(table, 
latestSpecOnly).stream()
         .collect(Collectors.toMap(PartitionField::name, Function.identity()));
     Expression finalExp = Expressions.alwaysTrue();
     for (Map.Entry<String, String> part : partitionSpec.entrySet()) {
       String partColName = part.getKey();
       if (partitionFieldMap.containsKey(partColName)) {
         PartitionField partitionField = partitionFieldMap.get(partColName);
         TransformSpec.TransformType transformType = 
TransformSpec.fromString(partitionField.transform().toString());
         if (TransformSpec.TransformType.IDENTITY == transformType) {
           final Type partKeyType = 
table.schema().findField(partitionField.sourceId()).type();
           final Object partKeyVal = 
Conversions.fromPartitionString(partKeyType, part.getValue());
           Expression boundPredicate = Expressions.equal(partColName, 
partKeyVal);
           finalExp = Expressions.and(finalExp, boundPredicate);
         } else {
           throw new SemanticException(
               String.format("Partition transforms are not supported here: %s", 
partColName));
         }
       } else {
         throw new SemanticException(String.format("No partition column by the 
name: %s", partColName));
       }
     }
     return finalExp;
   }
   ````



-- 
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]

Reply via email to