mirror of https://github.com/apache/druid.git
8649b8ab4c
* SQL: Allow select-sort-project query shapes. Fixes #7768. Design changes: - In PartialDruidQuery, allow projection after select + sort by removing the SELECT_SORT query stage and instead allowing the SORT and SORT_PROJECT stages to apply either after aggregation or after a plain non-aggregating select. This is different from prior behavior, where SORT and SORT_PROJECT were only considered valid after aggregation stages. This logic change is in the "canAccept" method. - In DruidQuery, represent either kind of sorting with a single "Sorting" class (instead of DefaultLimitSpec). The Sorting class is still convertible into a DefaultLimitSpec, but is also convertible into the sorting parameters accepted by a Scan query. - In DruidQuery, represent post-select and post-sorting projections with a single "Projection" class. This obsoletes the SortProject and SelectProjection classes, and simplifies the DruidQuery by allowing us to move virtual-column and post-aggregator-creation logic into the new Projection class. - Split "DruidQuerySignature" into RowSignature and VirtualColumnRegistry. This effectively means that instead of having mutable and immutable versions of DruidQuerySignature, we instead of RowSignature (always immutable) and VirtualColumnRegistry (always mutable, but sometimes null). This change wasn't required, but IMO it this makes the logic involving them easier to follow, and makes it more clear when the virtual column registry is active and when it's not. Other changes: - ConvertBoundsToSelectors now just accepts a RowSignature, but we use the VirtualColumnRegistry.getFullRowSignature() method to get a signature that includes all columns, and therefore allows us to simplify the logic (no need to special-case virtual columns). - Add `__time` to the Scan column list if the query is ordering by time. * Remove unused import. |
||
---|---|---|
.. | ||
main | ||
test |