Skip to content

[CALCITE-7594] Support GROUP BY ALL#5009

Merged
mihaibudiu merged 1 commit into
apache:mainfrom
tisyabhatia:CALCITE-7594
Jun 16, 2026
Merged

[CALCITE-7594] Support GROUP BY ALL#5009
mihaibudiu merged 1 commit into
apache:mainfrom
tisyabhatia:CALCITE-7594

Conversation

@tisyabhatia

@tisyabhatia tisyabhatia commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@tisyabhatia

tisyabhatia commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

CI failure is testExtractValue ("markup must be well-formed") which is unrelated to this change. Could a committer help with this?

@mihaibudiu

Copy link
Copy Markdown
Contributor

Where do you see that error?

@tisyabhatia

tisyabhatia commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@mihaibudiu

Copy link
Copy Markdown
Contributor

I see this error, which also tells you how to fix it:

java.lang.AssertionError: key 'GroupByAllRequiresExplicitSelectList' not found for resource 'groupByAllRequiresExplicitSelectList' in bundle 'java.util.PropertyResourceBundle@4b5c5087'; add the following line to org.apache.calcite.runtime.CalciteResource.properties:
--
  | GroupByAllRequiresExplicitSelectList=GROUP BY ALL requires an explicit SELECT list; '*' is not supported

@tisyabhatia

Copy link
Copy Markdown
Contributor Author

Thanks for replying, I completely missed that. Updated my PR

@mihaibudiu

Copy link
Copy Markdown
Contributor

See the comment I left on #5010

@mihaibudiu

Copy link
Copy Markdown
Contributor

In addition, there is a conformance flag called isGroupByAlias which should be tested in combination with this.

@xuzifu666

Copy link
Copy Markdown
Member

There is a pr to trace this jira, should this one can be closed?

@tisyabhatia

Copy link
Copy Markdown
Contributor Author

When GROUP BY ALL appears with no grouping items, group by every expression in the SELECT clause that does not contain an aggregate or window function and is not a measure. Parser forks the ALL branch on LOOKAHEAD(2); a trailing grouping list keeps the existing CALCITE-5089 ALL/DISTINCT set-quantifier behaviour; nothing trailing emits a GROUP_BY_ALL marker that the validator expands before base group validation. Constants are kept as grouping keys (grouping only by constants over empty input returns 0 rows, matching standard SQL and major dialects); SELECT * is rejected. Includes parser, validator, and execution tests plus reference docs.
@sonarqubecloud

Copy link
Copy Markdown

@tisyabhatia

Copy link
Copy Markdown
Contributor Author

I believe all review feedback has been addressed and the change is complete with tests. Could a committer take a look when you have a chance to move it toward approval/merge? Happy to make any further adjustments if needed. Thanks!

@mihaibudiu

Copy link
Copy Markdown
Contributor

In general, while you address feedback you should create new commits, which enable the reviewers to see what's changed. The commits will be squashed after the PR is accepted.


/** Test case for [CALCITE-7594] GROUP BY ALL: grouping only by a constant
* over empty input returns 0 rows. */
@Test void testGroupByAllOverEmptyInput() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the preferred way to write such tests is to use quidem files (suffix .iq), but this works too.

@mihaibudiu mihaibudiu added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Jun 15, 2026
@tisyabhatia

Copy link
Copy Markdown
Contributor Author

@mihaibudiu once this PR (and related, CALCITE-7597) is merged, is there any possibility of it going out in a patch release, or would it have to wait for the next rollout? (for context, I'm an intern working on adding support for these features to Flink)

@mihaibudiu

Copy link
Copy Markdown
Contributor

I don't think people will speed up a release for this feature, and 1.42 just happened. But you don't really need a release to incorporate these in another project. In our project we periodically choose a commit from the Calcite main branch and build against that. Especially for testing and benchmarking you should be able to do that.

@mihaibudiu mihaibudiu merged commit e62637b into apache:main Jun 16, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

LGTM-will-merge-soon Overall PR looks OK. Only minor things left.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants