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


##########
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergFilterFactory.java:
##########
@@ -97,22 +109,36 @@ private static Expression translate(ExpressionTree tree, 
List<PredicateLeaf> lea
    * @return Expression fully translated from Hive PredicateLeaf
    */
   private static Expression translateLeaf(PredicateLeaf leaf) {
-    String column = leaf.getColumnName();
+    TransformSpec transformSpec = 
TransformSpec.fromStringWithColumnName(leaf.getColumnName());
+    String column = transformSpec.getColumnName();
+    UnboundTerm<Object> columnTransform = getPartitionTransform(column, 
transformSpec);
+    boolean withoutTransform = columnTransform == null;
+
     switch (leaf.getOperator()) {
       case EQUALS:
-        Object literal = leafToLiteral(leaf);
-        return NaNUtil.isNaN(literal) ? isNaN(column) : equal(column, literal);
+        Object literal = leafToLiteral(leaf, transformSpec);
+        return NaNUtil.isNaN(literal) ?
+            (withoutTransform ? isNaN(column) : isNaN(columnTransform)) :
+            (withoutTransform ? equal(column, literal) : 
equal(columnTransform, literal));
       case LESS_THAN:
-        return lessThan(column, leafToLiteral(leaf));
+        return withoutTransform ?
+            lessThan(column, leafToLiteral(leaf, transformSpec)) :
+            lessThan(columnTransform, leafToLiteral(leaf, transformSpec));
       case LESS_THAN_EQUALS:
-        return lessThanOrEqual(column, leafToLiteral(leaf));
+        return withoutTransform ?
+            lessThanOrEqual(column, leafToLiteral(leaf, transformSpec)) :
+            lessThanOrEqual(columnTransform, leafToLiteral(leaf, 
transformSpec));

Review Comment:
   How does it work if it needs to translate a predicate with `GREATER_THEN` or 
`GREATER_THAN_EQUALS` operators?



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