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: [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]