ayushtkn commented on code in PR #5645:
URL: https://github.com/apache/hive/pull/5645#discussion_r1965539064


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java:
##########
@@ -1181,6 +1178,51 @@ public void 
preDropPartitions(org.apache.hadoop.hive.metastore.api.Table hmsTabl
     context.putToProperties(HiveMetaStoreClient.SKIP_DROP_PARTITION, "true");
   }
 
+  private static void validatePartitionSpec(SearchArgument sarg, Table 
icebergTbl,
+      Map<String, PartitionField> partitionFieldMap) {
+    for (PredicateLeaf leaf : sarg.getLeaves()) {
+      TransformSpec transformSpec = 
TransformSpec.fromStringWithColumnName(leaf.getColumnName());
+      Types.NestedField column = 
icebergTbl.schema().findField(transformSpec.getColumnName());
+      PartitionField partitionColumn =
+          partitionFieldMap.values().stream().filter(pf -> pf.sourceId() == 
column.fieldId()).findFirst().get();
+
+      if (!(partitionColumn.transform() == null && 
transformSpec.transformTypeString() == null) &&
+          
!partitionColumn.transform().toString().equalsIgnoreCase(transformSpec.transformTypeString()))
 {
+        throw new UnsupportedOperationException(
+            "Invalid transform for column: " + transformSpec.getColumnName() +
+                " Expected: " + partitionColumn.transform() +
+                " Found: " + transformSpec.getTransformType());
+      }
+    }
+  }
+
+  private static UnboundPredicate<Object> getPartitionPredicate(Table 
icebergTbl, PartitionData partitionData,
+      PartitionField field, int index) {
+    String columName = icebergTbl.schema().findField(field.sourceId()).name();
+    TransformSpec transformSpec = 
TransformSpec.fromString(field.transform().toString(), columName);
+
+    switch (transformSpec.getTransformType()) {

Review Comment:
   done



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