gianm opened a new pull request #11831:
URL: https://github.com/apache/druid/pull/11831
This has been possible in the native query system for a while, but the
capability
hasn't yet propagated into the SQL layer. One example of where this is
useful is
a query like:
```
SELECT * FROM (... LIMIT X) WHERE <filter>
```
Because this expands the kinds of subquery structures the SQL layer will
consider,
it was also necessary to improve the cost calculations. These changes appear
in
PartialDruidQuery and DruidOuterQueryRel. The ideas are:
- Attach per-column penalties to the output signature of each query, instead
of to
the initial projection that starts a query. This encourages moving
projections
into subqueries instead of leaving them on outer queries.
- Only attach penalties to projections if there are actually expressions
happening.
So, now, projections that simply reorder or remove fields are free.
- Attach a constant penalty to every outer query. This discourages creating
them
when they are not needed.
The changes are generally beneficial to the test cases we have in
CalciteQueryTest.
Most plans are unchanged, or are changed in purely cosmetic ways. Two have
changed
for the better:
- testUsingSubqueryWithLimit now returns a constant from the subquery,
instead of
returning every column.
- testJoinOuterGroupByAndSubqueryHasLimit returns a minimal set of columns
from
the innermost subquery; two unnecessary columns are no longer there.
--
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]