-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
[FLINK-37610] Check if orderBy keys exists before accessing #26407
base: master
Are you sure you want to change the base?
Conversation
...rg/apache/flink/table/planner/plan/optimize/program/FlinkChangelogModeInferenceProgram.scala
Outdated
Show resolved
Hide resolved
.orderKeys | ||
.getFieldCollations | ||
.isEmpty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out of curiosity: is there a case when it is not empty and over.logicWindow.groups
is empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No that can't happen since order by is specified inside the over clause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then I don't understand why do we need both !groups.isEmpty && !groups.get(0).orderKeys.getFieldCollations.isEmpty
in condition?
isn't just one of them enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this one condition should be enough i.e. !groups.get(0).orderKeys.getFieldCollations.isEmpty
but the condition !groups.isEmpty
is just a safety check. We can remove the safety check since there will always be 1 group.
- If ORDER BY clause is not specified in an Over agg, it would lead to IndexOutOfBoundsException - This commit adds a check to ensure orderby fields exists before accessing them
What is the purpose of the change
Brief change log
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (no)Documentation