Jackie-Jiang commented on code in PR #13199:
URL: https://github.com/apache/pinot/pull/13199#discussion_r1610592001
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/filter/AndFilterOperator.java:
##########
@@ -60,12 +63,21 @@ protected BlockDocIdSet getFalses() {
List<BlockDocIdSet> blockDocIdSets = new
ArrayList<>(_filterOperators.size());
for (BaseFilterOperator filterOperator : _filterOperators) {
if (filterOperator.isResultEmpty()) {
+ blockDocIdSets.add(EmptyDocIdSet.getInstance());
Review Comment:
Can we directly return match all here?
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/filter/AndFilterOperator.java:
##########
@@ -59,13 +60,14 @@ protected BlockDocIdSet getTrues() {
protected BlockDocIdSet getFalses() {
List<BlockDocIdSet> blockDocIdSets = new
ArrayList<>(_filterOperators.size());
for (BaseFilterOperator filterOperator : _filterOperators) {
- if (filterOperator.isResultEmpty()) {
- blockDocIdSets.add(new MatchAllDocIdSet(_numDocs));
+ if (_nullHandlingEnabled) {
+ blockDocIdSets.add(
+ new OrDocIdSet(Arrays.asList(filterOperator.getTrues(),
filterOperator.getNulls()), _numDocs));
Review Comment:
I see. Thanks for the explanation! Basically we are always taking the
overhead in `getFalses()`. I feel we should also try to optimize the default
`getFalses()` to check if `getNulls()` returns `EmptyDocIdSet`, and skip
creating `OrDocIdSet` if it is empty. The same optimization can also be applied
here
##########
pinot-core/src/main/java/org/apache/pinot/core/operator/filter/AndFilterOperator.java:
##########
@@ -60,12 +63,21 @@ protected BlockDocIdSet getFalses() {
List<BlockDocIdSet> blockDocIdSets = new
ArrayList<>(_filterOperators.size());
for (BaseFilterOperator filterOperator : _filterOperators) {
if (filterOperator.isResultEmpty()) {
+ blockDocIdSets.add(EmptyDocIdSet.getInstance());
+ continue;
+ }
+ if (filterOperator.isResultMatchingAll()) {
blockDocIdSets.add(new MatchAllDocIdSet(_numDocs));
Review Comment:
We probably don't need to add this. We can check how many `blockDocIdSets`
created in the end and construct the final `DocIdSet`
--
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]