clairemcginty commented on code in PR #1370:
URL: https://github.com/apache/parquet-java/pull/1370#discussion_r1626410600


##########
parquet-generator/src/main/java/org/apache/parquet/filter2/IncrementallyUpdatedFilterPredicateGenerator.java:
##########
@@ -299,22 +304,23 @@ private void addInNotInCase(TypeInfo info, boolean isEq) 
throws IOException {
         + "\n"
         + "          @Override\n"
         + "          public void update("
-        + info.primitiveName + " value) {\n" + "            boolean set = 
false;\n");
+        + info.primitiveName + " value) {\n");
 
+    if (expectMultipleResults) {
+      add("            if (isKnown()) return;\n");
+    }
     add("            for (" + info.primitiveName + " i : target) {\n");
 
     add("              if(" + compareEquality("value", "i", isEq) + ") {\n");
 
-    add("                 setResult(true);\n");
-
-    add("                 set = true;\n");
-
-    add("                 break;\n");
+    add("                 setResult(true);\n                 return;\n");

Review Comment:
   I simplified the existing ValueInspector logic a bit here. Previously it was:
   
   ```java
     @Override
     public void update(int value) {
        boolean set = false;
        for (int i : target) {
          if(comparator.compare(value, i) != 0) {
                 setResult(true);
                 set = true;
                 break;
           }
         }
         if (!set) setResult(false);
      }
    };
   }
   ```
   
   Now it's:
   ```java
   @Override
   public void update(int value) {
   for (int i : target) {
     if(comparator.compare(value, i) == 0 ) {
         setResult(true);
         return;
      }
    }
    setResult(false);
   }
   ```



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