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
handling window frame selection in case of same bound kind #16231
base: master
Are you sure you want to change the base?
Conversation
Range window
@@ -187,7 +187,7 @@ public AggInterval next() | |||
groupToRowIndex(relativeGroupId(1)) | |||
), | |||
Interval.of( | |||
groupToRowIndex(relativeGroupId(-lowerOffset)), | |||
groupToRowIndex(relativeGroupId(lowerOffset < 0 ? lowerOffset : -lowerOffset)), |
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.
this doesn't look right - this is effectively: -Math.abs(lowerOffset)
this part was already working with relative offsets ; so I think it should be simply relativeGroupId(lowerOffset)
- didn't that worked?
int resultStorageIndex = 0; | ||
|
||
// if the upper offset is -ve, then we need to ignore those many rows prior to the current row | ||
int resultStorageIndex = -1 * Math.min(upperOffset, 0); |
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.
nit: why not use an unary -
?
Description
This PR aims to handle the following cases in window frame selection
rows between unbounded preceding and x preceding
rows between x following and unbounded following
rows between x preceding and y preceding
rows between x following and y following
Key changed/added classes in this PR
DefaultFramedOnHeapAggregatable.java
DruidSqlValidator.java
Windowing.java
This PR has: