Skip to content

[CALCITE-6036] Support WITHIN GROUP(ORDER BY x) OVER (PARTITION BY y) - #5078

Merged
xuzifu666 merged 1 commit into
apache:mainfrom
xuzifu666:6036-support
Jul 10, 2026
Merged

[CALCITE-6036] Support WITHIN GROUP(ORDER BY x) OVER (PARTITION BY y)#5078
xuzifu666 merged 1 commit into
apache:mainfrom
xuzifu666:6036-support

Conversation

@xuzifu666

Copy link
Copy Markdown
Member

!use scott-babel
!set outputformat mysql

# The following 3 tests are related to this issue.

@xuzifu666 xuzifu666 Jul 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since Enumerable does not currently support the PERCENTILE_CONT/PERCENTILE_DISC function, I did not use the function provided in the JIRA ticket; instead, I use listagg function to test.
Validated in oracle: https://onecompiler.com/oracle/44tzw78rb and result is as expected.

* WITHIN GROUP clause with an OVER clause is non-standard (Oracle) syntax that
* is only allowed under a conformance that enables it, such as BABEL. */
@Test void testPercentileWithinGroupOver() {
final String sql = "select\n"

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.

would be great also having tests for unparsing especially if there is expression under order by /partition by

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

OK, I had a test for unparsing, PTAL

@xuzifu666
xuzifu666 requested a review from snuyanzin July 5, 2026 09:57
@xuzifu666

Copy link
Copy Markdown
Member Author

Could you help to take a look for it again? I'm not sure whether you are happy with these changes, thanks~ @snuyanzin

@snuyanzin

Copy link
Copy Markdown
Contributor

thanks for addressing the feedback
sorry for the delay, was busy with on call shift

@xuzifu666

Copy link
Copy Markdown
Member Author

Thanks for your review @snuyanzin and this PR has been open for a few days; if there are no further comments, I will merge it in the coming days.

@xuzifu666 xuzifu666 added the LGTM-will-merge-soon Overall PR looks OK. Only minor things left. label Jul 9, 2026
@sonarqubecloud

Copy link
Copy Markdown

@xuzifu666
xuzifu666 merged commit e15c395 into apache:main Jul 10, 2026
20 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.

2 participants