-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix v1 query engine behavior for aggregations without group by where …
…the limit is zero (#13564)
- Loading branch information
Showing
5 changed files
with
110 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
pinot-core/src/main/java/org/apache/pinot/core/operator/query/EmptyAggregationOperator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.pinot.core.operator.query; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import org.apache.pinot.core.common.Operator; | ||
import org.apache.pinot.core.operator.BaseOperator; | ||
import org.apache.pinot.core.operator.ExecutionStatistics; | ||
import org.apache.pinot.core.operator.blocks.results.AggregationResultsBlock; | ||
import org.apache.pinot.core.query.request.context.QueryContext; | ||
|
||
|
||
/** | ||
* The <code>EmptyAggregationOperator</code> provides a way to short circuit aggregation only queries (no group by) | ||
* with a LIMIT of zero. | ||
*/ | ||
public class EmptyAggregationOperator extends BaseOperator<AggregationResultsBlock> { | ||
|
||
private static final String EXPLAIN_NAME = "AGGREGATE_EMPTY"; | ||
private final QueryContext _queryContext; | ||
private final ExecutionStatistics _executionStatistics; | ||
|
||
public EmptyAggregationOperator(QueryContext queryContext, int numTotalDocs) { | ||
_queryContext = queryContext; | ||
_executionStatistics = new ExecutionStatistics(0, 0, 0, numTotalDocs); | ||
} | ||
|
||
@Override | ||
protected AggregationResultsBlock getNextBlock() { | ||
return new AggregationResultsBlock(_queryContext.getAggregationFunctions(), Collections.emptyList(), _queryContext); | ||
} | ||
|
||
@Override | ||
public List<Operator> getChildOperators() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public String toExplainString() { | ||
return EXPLAIN_NAME; | ||
} | ||
|
||
@Override | ||
public ExecutionStatistics getExecutionStatistics() { | ||
return _executionStatistics; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters