Skip to content

Commit

Permalink
Fix issue with group by combine operator when limit is zero (#13555)
Browse files Browse the repository at this point in the history
  • Loading branch information
yashmayya authored Jul 8, 2024
1 parent cf1a0f6 commit 42b63d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ protected IndexedTable(DataSchema dataSchema, boolean hasFinalInput, QueryContex
int trimSize, int trimThreshold, Map<Key, Record> lookupMap) {
super(dataSchema);

Preconditions.checkArgument(resultSize > 0, "Result size should be a non-zero positive integer");
Preconditions.checkArgument(trimSize > 0, "Trim size should be a non-zero positive integer");
Preconditions.checkArgument(trimThreshold > 0, "Trim threshold should be a non-zero positive integer");
Preconditions.checkArgument(resultSize >= 0, "Result size can't be negative");
Preconditions.checkArgument(trimSize >= 0, "Trim size can't be negative");
Preconditions.checkArgument(trimThreshold >= 0, "Trim threshold can't be negative");

_lookupMap = lookupMap;
_hasFinalInput = hasFinalInput;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3472,6 +3472,13 @@ public void testBooleanAggregation()
testQuery("SELECT BOOL_OR(CAST(Diverted AS BOOLEAN)) FROM mytable");
}

@Test(dataProvider = "useBothQueryEngines")
public void testGroupByAggregationWithLimitZero(boolean useMultiStageQueryEngine)
throws Exception {
setUseMultiStageQueryEngine(useMultiStageQueryEngine);
testQuery("SELECT Origin, SUM(ArrDelay) FROM mytable GROUP BY Origin LIMIT 0");
}

private String buildSkipIndexesOption(String columnsAndIndexes) {
return "SET " + SKIP_INDEXES + "='" + columnsAndIndexes + "'; ";
}
Expand Down

0 comments on commit 42b63d8

Please sign in to comment.