gianm commented on code in PR #15611:
URL: https://github.com/apache/druid/pull/15611#discussion_r1440664951


##########
processing/src/main/java/org/apache/druid/query/filter/InDimFilter.java:
##########
@@ -227,22 +228,32 @@ public byte[] getCacheKey()
   }
 
   @Override
-  public DimFilter optimize()
+  public DimFilter optimize(final boolean mayIncludeUnknown)
   {
-    InDimFilter inFilter = optimizeLookup();
+    final ExtractionFn newExtractionFn;
+    ValuesSet newValues = optimizeLookup(this, mayIncludeUnknown);
 
-    if (inFilter.values.isEmpty()) {
-      return FalseDimFilter.instance();
+    if (newValues == null) {
+      newValues = values;
+      newExtractionFn = extractionFn;
+    } else {
+      newExtractionFn = null;
     }
-    if (inFilter.values.size() == 1) {
+
+    if (newValues.isEmpty()) {
+      return FalseDimFilter.instance();
+    } else if (newValues.size() == 1) {
       return new SelectorDimFilter(
-          inFilter.dimension,
-          inFilter.values.iterator().next(),
-          inFilter.getExtractionFn(),
+          dimension,
+          newValues.iterator().next(),
+          newExtractionFn,
           filterTuning
       );
+    } else if (newValues == values) {
+      return this;

Review Comment:
   I think no, because the checks for `values` size are still needed to turn 
the filter into a `false` or `selector` filter if it has zero or one elements. 
(Even with no `extractionFn`)



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