You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/06/01 03:26:49 UTC

[GitHub] [flink-table-store] JingsongLi commented on a diff in pull request #143: [FLINK-27835] Introduce LeafPredicate interface and children method in Predicate

JingsongLi commented on code in PR #143:
URL: https://github.com/apache/flink-table-store/pull/143#discussion_r886278203


##########
flink-table-store-core/src/main/java/org/apache/flink/table/store/file/predicate/And.java:
##########
@@ -20,57 +20,40 @@
 
 import org.apache.flink.table.store.file.stats.FieldStats;
 
-import java.util.Objects;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Optional;
 
-/** A {@link Predicate} to eval and. */
-public class And implements Predicate {
+/** A {@link CompoundPredicate.Function} to eval and. */
+public class And implements CompoundPredicate.Function {
 
     private static final long serialVersionUID = 1L;
 
-    private final Predicate predicate1;
-    private final Predicate predicate2;
+    public static final And INSTANCE = new And();
 
-    public And(Predicate predicate1, Predicate predicate2) {
-        this.predicate1 = predicate1;
-        this.predicate2 = predicate2;
-    }
+    private And() {}
 
     @Override
-    public boolean test(Object[] values) {
-        return predicate1.test(values) && predicate2.test(values);
+    public boolean test(Object[] values, List<Predicate> children) {
+        return children.stream().allMatch(p -> p.test(values));

Review Comment:
   Don't use java8 stream in critical path, it has poor performance.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org