Skip to content

IGNITE-27976 Support OVER clause with unbounded frame#12815

Open
vldpyatkov wants to merge 7 commits intoapache:masterfrom
vldpyatkov:ignite-27976
Open

IGNITE-27976 Support OVER clause with unbounded frame#12815
vldpyatkov wants to merge 7 commits intoapache:masterfrom
vldpyatkov:ignite-27976

Conversation

@vldpyatkov
Copy link
Contributor

*/
private static List<RexNode> buildProjection(RelNode join, LogicalWindow win, LogicalWindow.Group grp) {
RexBuilder rexBuilder = win.getCluster().getRexBuilder();
int inputFieldCnt = win.getInput().getRowType().getFieldCount();
Copy link
Contributor

Choose a reason for hiding this comment

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

no one test is covered case where inputFieldCnt != 0, it need to be covered or removed if unnecessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

inputFieldCnt - count of fields in the input projection, before a window group calculation.
grpKeyCnt - count of fields into "PARTITION BY" clause.
aggFieldCnt - count of aggregate functions in the windows group.
These vars are not 0 in almost all queries.

Comment on lines +237 to +238
RexNode left = rexBuilder.makeInputRef(joinRowType, keyIdx);
RexNode right = rexBuilder.makeInputRef(joinRowType, inputFieldCnt + i);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
RexNode left = rexBuilder.makeInputRef(joinRowType, keyIdx);
RexNode right = rexBuilder.makeInputRef(joinRowType, inputFieldCnt + i);
RexNode left = rexBuilder.makeInputRef(input.getRowType(), keyIdx);
RexNode right = rexBuilder.makeInputRef(agg.getRowType(), inputFieldCnt + i);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I doubt the type calculation, but nothing failed when I did it like you said.
So, finally, this change applied.

@zstan
Copy link
Contributor

zstan commented Mar 5, 2026

Overall looks good, one case is questionable - what the plan for supporting "ORDER BY" ? Did this rule still be helpful or it need to be ovewritten at all ? @alex-plekhanov plz take a look too ?

@vldpyatkov
Copy link
Contributor Author

Overall looks good, one case is questionable - what the plan for supporting "ORDER BY" ? Did this rule still be helpful or it need to be ovewritten at all ? @alex-plekhanov plz take a look too ?

Unfortunately, the "ORDER BY" clause is far from the entire implementation of window functions.
This implementation is limited by the ticket description.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
3 New Code Smells (required ≤ 1)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants