clintropolis opened a new pull request #10440:
URL: https://github.com/apache/druid/pull/10440
### Description
This PR builds on top of #10401, and adds optimized selectors for constant
expressions of all types, including single value dimension vector selectors. To
aid in this, it adds a new utility class `ConstantVectorSelectors` to provide
methods for creating constant `SingleValueDimensionVectorSelector`,
`VectorValueSelector`, and `VectorObjectSelector`, for use for constant
expression in
`ExpressionVectorSelectors.makeSingleValueDimensionVectorSelector` (new in this
PR), `ExpressionVectorSelectors.makeVectorValueSelector`, and
`ExpressionVectorSelectors.makeVectorObjectSelector`.
Supporting single value dimension selector constants is important because
SQL queries such as:
```
SELECT TIME_FLOOR(__time, 'PT1H'), string2, SUM(long1 * double4) FROM foo
WHERE string2 = '10' GROUP BY 1,2 ORDER BY 3
```
plan into a native group by query with an expression virtual column with
'10' as the constant expression in place of the 'string2' dimension, because
Calcite assumes that a constant is cheaper than reading the column. However,
since the single value dimension vector selector was not yet implemented, this
would cause the query to be unable to vectorize, which is fixed in this PR (and
a test added).
<hr>
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.
- [ ] 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/licenses.yaml)
- [ ] 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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]