LakshSingla opened a new pull request, #15474:
URL: https://github.com/apache/druid/pull/15474
### Description
In MSQ, each partition corresponds to a single segment (if it is the end
stage) or the unit of work that is assigned to a worker. If the clustering key
has low cardinality, then the returned partitions can be too large. For certain
stages, we can break up the resulting partitions by introducing a synthetic
clustering column "__boost" (which should contain a unique value -
incrementally increasing longs for MSQ's implementation) at the end of the
clustering keys, so that the keys become unique, and the partition boundaries
are respectable. This is done in ScanQueryKit, and can be done in the
GroupByPostShuffleFrameProcessor.
This PR introduces this partition boosting to the group by queries as well.
For example, the queries of the form
```
INSERT INTO table
SELECT dim1, dim2, agg(metric1) as aggregated FROM EXTERN(...)
GROUP BY dim1, dim2
PARTITIONED BY YEAR
CLUSTERED BY aggregated
```
can run into large segments if the "aggregated" is a very low cardinality
column, and the (dim1, dim2) is a high cardinality pair. The solution (before
the patch) would be to add more dims into the CLUSTERED BY clause to make it
more unique. Post this patch, that won't be required.
ControllerImpl already handles partition-boosted columns specially.
**NOTE**: Group by queries can fail during the cluster upgrade, if some of
the workers are on an older version, while the others are on a newer version.
#### Release note
<hr>
##### Key changed/added classes in this PR
* `MyFoo`
* `OurBar`
* `TheirBaz`
<hr>
<!-- Check the items by putting "x" in the brackets for the done things. Not
all of these items apply to every PR. Remove the items which are not done or
not relevant to the PR. None of the items from the checklist below are strictly
necessary, but it would be very helpful if you at least self-review the PR. -->
This PR has:
- [ ] been self-reviewed.
- [ ] using the [concurrency
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
(Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked
related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code
wherever would not be obvious for an unfamiliar reader.
- [ ] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold for [code
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
is met.
- [ ] added integration tests.
- [ ] been tested in a test Druid cluster.
--
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]