1fanwang opened a new pull request, #5202: URL: https://github.com/apache/calcite/pull/5202
## Jira Link [CALCITE-6087](https://issues.apache.org/jira/browse/CALCITE-6087) ## Changes Proposed An empty global aggregate implemented by `EnumerableSortedAggregate` returns no row. For example, `MAX` and `COUNT` over an empty input should return one row containing `NULL` and `0`, but the result is empty. Sorted grouping emits one row per observed key, and a global aggregate has no grouping key. The sorted aggregate rule now declines an empty group set so `EnumerableAggregate` handles it through its zero-key singleton path. Grouped sorted aggregates are unchanged. ## Testing | Scenario | Result | | --- | --- | | Forced sorted aggregate before the fix | Reproduced an empty result instead of `m=null; c=0` | | Focused regression test | 1 passed | | Core test suite | 16,639 passed, 157 skipped | <details> <summary>Raw logs</summary> ```text $ JAVA_HOME=$(/usr/libexec/java_home -v 21) ./gradlew :core:test --tests org.apache.calcite.test.enumerable.EnumerableSortedAggregateTest.sortedAggOnEmptyInput --no-daemon --console=plain Expected: "m=null; c=0" but: was "" 1 test completed, 1 failed BUILD FAILED $ JAVA_HOME=$(/usr/libexec/java_home -v 21) ./gradlew :core:test --tests org.apache.calcite.test.enumerable.EnumerableSortedAggregateTest.sortedAggRuleOnEmptyInput --no-daemon --console=plain 1 completed, 0 failed, 0 skipped BUILD SUCCESSFUL $ JAVA_HOME=$(/usr/libexec/java_home -v 21) ./gradlew :core:test --no-daemon --console=plain 16639 completed, 0 failed, 157 skipped BUILD SUCCESSFUL ``` </details> Formatting, Checkstyle, and forbidden-apis checks pass. -- 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]
