deniskuzZ commented on code in PR #6954:
URL: https://github.com/apache/hive/pull/6954#discussion_r4537710191
##########
ql/src/test/org/apache/hadoop/hive/ql/io/parquet/read/TestParquetFilterPredicate.java:
##########
@@ -736,4 +741,120 @@ public void testFilterMoreComplexVarCharColumn() throws
Exception {
+ "or(eq(c, Binary{\"banana\"}), lt(d, Binary{\"cherry\"})))";
assertEquals(expected, p.toString());
}
+
+ /** A single-literal leaf whose runtime value is not available is dropped;
the rest of the conjunction filters. */
+ @Test
+ public void testUnresolvedSingleLiteralDropsOnlyItsLeaf() {
+ SearchArgument sarg = SearchArgumentFactory.newBuilder()
+ .startAnd()
+ .lessThan("a", PredicateLeaf.Type.LONG, 5L)
+ .equals("b", PredicateLeaf.Type.LONG, unresolved())
+ .end()
+ .build();
+ assertEquals("lt(a, 5)", String.valueOf(toFilterPredicateOverAbc(sarg)));
+ }
+
+ /** A BETWEEN leaf whose runtime values are not available is dropped; the
rest of the conjunction filters. */
+ @Test
+ public void testUnresolvedBetweenDropsOnlyItsLeaf() {
+ SearchArgument sarg = SearchArgumentFactory.newBuilder()
+ .startAnd()
+ .lessThan("a", PredicateLeaf.Type.LONG, 5L)
+ .between("c", PredicateLeaf.Type.LONG, unresolved(), unresolved())
+ .end()
+ .build();
+ assertEquals("lt(a, 5)", String.valueOf(toFilterPredicateOverAbc(sarg)));
+ }
+
+ /** A BETWEEN leaf with only one of its runtime bounds resolved to a value
is dropped. */
+ @Test
+ public void testBetweenWithOneNullRuntimeBoundDropsOnlyItsLeaf() {
+ SearchArgument sarg = SearchArgumentFactory.newBuilder()
+ .startAnd()
+ .lessThan("a", PredicateLeaf.Type.LONG, 5L)
+ .between("c", PredicateLeaf.Type.LONG, resolvedTo(null),
resolvedTo(10L))
+ .end()
+ .build();
+ assertEquals("lt(a, 5)", String.valueOf(toFilterPredicateOverAbc(sarg)));
+ }
+
+ /** A negated unresolved leaf filters nothing either: the search argument
pushes NOT down to the leaves. */
+ @Test
+ public void testNegatedUnresolvedLeafDropsOnlyItsLeaf() {
Review Comment:
Nit: this test seems redundant. Without the fix it fails for the same reason
as testUnresolvedSingleLiteralDropsOnlyItsLeaf: getLiteral() throws
NoDynamicValuesException.
With the fix, the NOT case is handled by translate()'s existing NOT branch,
not by this change
Fine to keep if you want the NOT case documented
--
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]