You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "gianm (via GitHub)" <gi...@apache.org> on 2023/03/13 18:28:10 UTC

[GitHub] [druid] gianm commented on a diff in pull request #13922: Refactoring and bug fixes on top of unnest. The allowList now is not passed …

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


##########
processing/src/main/java/org/apache/druid/segment/UnnestStorageAdapter.java:
##########
@@ -293,13 +293,16 @@ void add(@Nullable final Filter filter)
         }
 
         if (requiredColumns.contains(outputColumnName)) {
-          // Try to move filter pre-correlate if possible.
+          // Rewrite filter post-unnest if possible.
           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);
-          } else {
-            postFilters.add(filter);
           }
+          // This is needed as a filter on an MV String Dimension returns the entire row matching the filter

Review Comment:
   Above comment is still relevant.



##########
processing/src/main/java/org/apache/druid/segment/UnnestStorageAdapter.java:
##########
@@ -120,27 +117,27 @@ public Sequence<Cursor> makeCursors(
                   retVal,
                   retVal.getColumnSelectorFactory(),
                   unnestColumn,
-                  outputColumnName,
-                  allowSet
+                  outputColumnName
               );
             } else {
               retVal = new UnnestColumnValueSelectorCursor(
                   retVal,
                   retVal.getColumnSelectorFactory(),
                   unnestColumn,
-                  outputColumnName,
-                  allowSet
+                  outputColumnName
               );
             }
           } else {
             retVal = new UnnestColumnValueSelectorCursor(
                 retVal,
                 retVal.getColumnSelectorFactory(),
                 unnestColumn,
-                outputColumnName,
-                allowSet
+                outputColumnName
             );
           }
+          // This is needed at this moment for nested queries
+          // Future developer would want to move the virtual columns

Review Comment:
   Why would a future developer want to do this? (Not a rhetorical question: I really don't know.) Please add some rationale to the comment so people know what you have in mind.



-- 
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: commits-unsubscribe@druid.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org