Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for Aggregation inside a window clause when syntax used as - WINDOW W AS DEF #16801

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

sreemanamala
Copy link
Contributor

Description

Currently calcite does not support a window query where aggregation is present on the nodes inside window clause if the window is provided in the select list. So this commit checks for such cases and provide an actionable error msg to use a different syntax.
example:

SELECT
row_number() over w as c
FROM table
WINDOW w as (partition by aggr(col1) order by col2)

would not work. Where as

SELECT
row_number() over (partition by aggr(col1) order by col2) as c
FROM table

works fine.

This check is to be removed once CALCITE-6500 is fixed


Key changed/added classes in this PR
  • DruidSqlValidator

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • added integration tests.
  • been tested in a test Druid cluster.

Copy link
Member

@kgyrtkirk kgyrtkirk left a comment

Choose a reason for hiding this comment

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

looks good!
just some minor changes + green run is needed

@kgyrtkirk kgyrtkirk merged commit 9b76d13 into apache:master Jul 26, 2024
88 checks passed
@sreemanamala sreemanamala deleted the win-select-agg branch July 26, 2024 09:19
sreemanamala added a commit to sreemanamala/druid that referenced this pull request Aug 6, 2024
@kfaraz kfaraz added this to the 31.0.0 milestone Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants