-
Notifications
You must be signed in to change notification settings - Fork 590
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
feat(over window): window function RANGE
frame support - backend part
#14416
Conversation
18dd81c
to
ec57ab0
Compare
513a2a6
to
cb73122
Compare
ec57ab0
to
5453356
Compare
7c7f9f9
to
61df00f
Compare
5453356
to
17eb72f
Compare
61df00f
to
2e3ec9a
Compare
17eb72f
to
c365bd0
Compare
49ea439
to
5c88fec
Compare
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
84b2e41
to
a16d90d
Compare
474d9d6
to
4e1a4dd
Compare
a16d90d
to
845c28d
Compare
c894a25
to
3fad06a
Compare
845c28d
to
9845051
Compare
3fad06a
to
08e5e77
Compare
9845051
to
90b837c
Compare
08e5e77
to
14d0113
Compare
90b837c
to
65b6f9a
Compare
14d0113
to
cf16e2d
Compare
26d6ca8
to
10df303
Compare
538c8f4
to
46f031e
Compare
10df303
to
6633942
Compare
46f031e
to
8566755
Compare
6633942
to
f029b94
Compare
f029b94
to
f4e4e7b
Compare
Preceding(offset) => Following(offset), | ||
CurrentRow => CurrentRow, | ||
Following(offset) => Preceding(offset), | ||
UnboundedFollowing => UnboundedPreceding, |
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.
It seems that FrameBound<usize>
and FrameBound<RangeFrameOffset>
are so different that they don't really need to be variants of same type. How about just saparating them as 2 types, such as RowsFrameBound
and RangeFrameBound
?
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.
IMO although they have many different methods and are used very differently, in their core they are the same concept, so I decided to introduce a generic type. Also I didn't want to repeat the 5 enum variants for two times (will be 3 times when we support GROUPS
frame later).
Maybe we can type RowsFrameBound = FrameBound<usize>;
to make it easier to read.
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.
Introducing type aliases sounds good
} | ||
|
||
#[test] | ||
fn test_calc_logical_for_timestamp_desc_nulls_first() { |
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.
The timestamp format seemed to be supported actually, but why it's disabled in the planner test?
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.
timestamp
and timestamptz
are supported. While for timestamptz
, we only support offset to be interval without month
and day
fields, because that requires timezone info to do calculation and is not currently supported by our Add(Timestamptz, Interval)
expression.
@@ -143,6 +147,73 @@ pub(super) fn find_frame_end_for_rows_frame<'cache>( | |||
find_boundary_for_rows_frame::<false /* RIGHT */>(frame_bounds, part_with_delta, curr_key) | |||
} | |||
|
|||
/// Given the first and last key in delta, calculate the order values of the first | |||
/// and the last frames logically affected by some `RANGE` frames. | |||
pub(super) fn calc_logical_curr_for_range_frames( |
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.
Managed to understand the function, but didn't quite get the point of "logical"
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.
By "logical (current key)" I mean the current key will be affected if it exists, but in actual we may not find the logical current key in the cache + delta, hence consider the closest one as the "actual current key".
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.
LGTM
f4e4e7b
to
392a6a1
Compare
ee5fa37
to
46f45dd
Compare
392a6a1
to
4f9b76f
Compare
Signed-off-by: Richard Chien <[email protected]> add comment Signed-off-by: Richard Chien <[email protected]> order type little things Signed-off-by: Richard Chien <[email protected]> `fnd_affected_ranges` seems to work now Signed-off-by: Richard Chien <[email protected]> typo Signed-off-by: Richard Chien <[email protected]> typo Signed-off-by: Richard Chien <[email protected]> typo Signed-off-by: Richard Chien <[email protected]> simplify frame start/end calculation Signed-off-by: Richard Chien <[email protected]> minor Signed-off-by: Richard Chien <[email protected]> check range frame bounds Signed-off-by: Richard Chien <[email protected]> add comment Signed-off-by: Richard Chien <[email protected]> display RangeFrameBounds Signed-off-by: Richard Chien <[email protected]> make `WindowBuffer` only handle `ROWS` frame Signed-off-by: Richard Chien <[email protected]> reorder methods Signed-off-by: Richard Chien <[email protected]> unify Signed-off-by: Richard Chien <[email protected]> allow end-2-end range frame queries Signed-off-by: Richard Chien <[email protected]> minor Signed-off-by: Richard Chien <[email protected]> use real order key data type and order type Signed-off-by: Richard Chien <[email protected]> store order data type and order type in `RangeFrameBounds` Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
4f9b76f
to
4594b29
Compare
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR implements the real
RANGE
frame support in backend executors. Resolves #11109.The basic idea to support
RANGE
frame infind_affected_ranges
is to:ROWS
frames, choose the minimum/maximum one as the final first/last current key;ROWS
frames, choose the minimum/maximum one, similar to step 3.The basic idea to support
RANGE
frame inWindowBuffer
is to:118x out of 17xx lines of addition are tests, reviewers plz don't panic.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
RANGE
frames in window function calls.