ayushtkn commented on code in PR #5645:
URL: https://github.com/apache/hive/pull/5645#discussion_r1964885606
##########
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:
While creating the SearchArgument, the `GREATER_THAN` and
`GREATER_THAN_EQUALS` are converted to not `LESS_THAN_EQUALS` and `LESS_THAN`
https://github.com/apache/hive/blob/c4c7a78dcb06af67a49f8b6983ea3b22ccf14551/ql/src/java/org/apache/hadoop/hive/ql/io/sarg/ConvertAstToSearchArg.java#L485-L488
It is generic to Hive, not specific to our case. I have a test case covering
the >= scenario in the test as well:
https://github.com/ayushtkn/hive/blob/f21fb202bca46875baaf79e2056657f23562d9d7/iceberg/iceberg-handler/src/test/queries/positive/iceberg_drop_partition_transform_column.q#L79
--
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]