libenchao commented on code in PR #21956:
URL: https://github.com/apache/flink/pull/21956#discussion_r1112600693


##########
flink-formats/flink-orc/src/test/java/org/apache/flink/orc/OrcFileSystemFilterTest.java:
##########
@@ -74,5 +75,20 @@ public void testApplyPredicate() {
         OrcFilters.Predicate predicate6 =
                 new OrcFilters.LessThan("long1", PredicateLeaf.Type.LONG, 10);
         assertThat(predicate5).hasToString(predicate6.toString());
+
+        // and
+        CallExpression andExpression =
+                CallExpression.permanent(
+                        BuiltInFunctionDefinitions.AND,
+                        Arrays.asList(greaterExpression, lessExpression),
+                        DataTypes.BOOLEAN());
+        OrcFilters.Predicate predicate7 = 
OrcFilters.toOrcPredicate(andExpression);
+        OrcFilters.Predicate predicate8 =
+                new OrcFilters.And(
+                        new OrcFilters.Not(
+                                new OrcFilters.LessThanEquals(
+                                        "long1", PredicateLeaf.Type.LONG, 10)),
+                        new OrcFilters.LessThan("long1", 
PredicateLeaf.Type.LONG, 10));

Review Comment:
   Does `new OrcFilters.And(predicate4, predicate6);` also work? If so, it 
would be more clean, WDYT?



##########
flink-formats/flink-orc/src/main/java/org/apache/flink/orc/OrcFilters.java:
##########
@@ -719,4 +736,32 @@ public String toString() {
             return "OR(" + Arrays.toString(preds) + ")";
         }
     }
+
+    /** An AND predicate that can be evaluated by the OrcInputFormat. */
+    public static class And extends Predicate {
+        private final Predicate[] preds;
+
+        /**
+         * Creates an AND predicate.
+         *
+         * @param predicates The disjunctive predicates.

Review Comment:
   there predicates should be `conjunctive` predicates.



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

Reply via email to