somu-imply commented on code in PR #13934:
URL: https://github.com/apache/druid/pull/13934#discussion_r1137959201


##########
processing/src/main/java/org/apache/druid/segment/UnnestStorageAdapter.java:
##########
@@ -285,31 +311,53 @@ void add(@Nullable final Filter filter)
             }
           }
         }
+        preFilters.add(filter);
+
+      }
+    }
 
-        if (requiredColumns.contains(outputColumnName)) {
-          // Rewrite filter post-unnest if possible.
+    final FilterSplitter filterSplitter = new FilterSplitter();
+
+    // non-unnest case
+    // OR CASE
+    List<Filter> preFilterList = new ArrayList<>();
+    List<Filter> postFilterList = new ArrayList<>();
+    if (queryFilter instanceof OrFilter) {
+      for (Filter filter : ((OrFilter) queryFilter).getFilters()) {
+        if (filter.getRequiredColumns().contains(outputColumnName)) {
           final Filter newFilter = 
rewriteFilterOnUnnestColumnIfPossible(filter, inputColumn, 
inputColumnCapabilites);
           if (newFilter != null) {
-            // Add the rewritten filter pre-unnest, so we get the benefit of 
any indexes, and so we avoid unnesting
-            // any rows that do not match this filter at all.
-            preFilters.add(newFilter);
+            preFilterList.add(newFilter);
+            postFilterList.add(newFilter);

Review Comment:
   This has been refactored with comments



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