cecemei opened a new pull request, #17055:
URL: https://github.com/apache/druid/pull/17055
Refactors how FilterBundle is constructed in Filter and
QueryableIndexCursorHolder.
### Description
Before this PR, `QueryableIndexCursorHolder` calls `Filter.makeFilterBundle`
to build FilterBundle. The `BitmapColumnIndex.computeBitmapResult` is called at
the same time. In the logical AndFilter and OrFilter, the ordering of child
filters would affect what indices are chosen. Since filters could have
different compute cost (a.k.a union multiple bitmaps is more expensive than
single bitmap), we'd like less expensive filters to be computed first.
After this PR, `QueryableIndexCursorHolder` builds a `FilterBundle.Builder`
instance, which contains useful information such as `ColumnIndexSelector` and
`BitmapColumnIndex`, then calls `builds` to build FilterBundle. The actual
build logic still exists in `Filter.makeFilterBundle`, since
`AndFilter/OrFilter` could have separate logic from other `Filter`. This
enables `AndFilter/OrFilter` to sort its child filters by the computing cost in
ascending order, before making the `BitmapColumnIndex.computeBitmapResult`
calls.
For now, all indices would have a cost of `Integer.MAX_VALUE`, I intend to
make a future PR to update cost for all inherited `BitmapColumnIndex` classes.
Note that this PR would not have any real impact on building `FilterBundle`,
since all filters having the same cost so there's no real sorting.
Alternatively we've considered making `FilterBundle.IndexBundle` to store
all indices and delay the index/matcher partitioning. The major con is that
this seems like changing existing behavior too much and it could mean a lot of
rewrite to existing `FilterBundle` class and `Filter.makeFilterBundle` method.
<hr>
##### Key changed/added classes in this PR
* `FilterBundle.Builder`
* `FilterBundle`
* `Filter`
* `BooleanFilter`
* `AndFilter`
* `OrFilter`
* `BitmapColumnIndex`
* `QueryableIndexCursorHolder`
<hr>
This PR has:
- [X] been self-reviewed.
- [X] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [X] 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)
- [X] 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]