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(stream,over-window): implement AggregateState
to allow aggregate function over window
#9248
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
7dad266
to
be50b16
Compare
54e388d
to
203f729
Compare
AggregateState
to allow aggregate over windowAggregateState
to allow aggregate function over window
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
773aa63
to
9818593
Compare
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Codecov Report
@@ Coverage Diff @@
## main #9248 +/- ##
==========================================
+ Coverage 70.79% 70.85% +0.05%
==========================================
Files 1216 1218 +2
Lines 202120 202616 +496
==========================================
+ Hits 143089 143560 +471
- Misses 59031 59056 +25
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 6 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
assert!(start_off <= end_off); | ||
} | ||
if end_off <= 0 { | ||
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.
should it be LEFT_IDX
here?
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.
Seems to have bug here, let me add some unit tests later.
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.
Fixed a bug related to index maintaining, PTAL
@@ -363,7 +362,9 @@ impl<S: StateStore> OverWindowExecutor<S> { | |||
let (ret_values, evict_hints): (Vec<_>, Vec<_>) = partition | |||
.states | |||
.iter_mut() | |||
.map(|state| state.slide()) | |||
.map(|state| state.output()) | |||
.try_collect::<Vec<_>>()? |
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.
What is the point of returning an error early here when .map(|o| (o.return_value, o.evict_hint)) has no side effects?
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.
Because batch aggregator will possibly throw an error
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.
Agree, but the collect is unnecessary if we have rust-itertools/itertools#402
We can resolve it later :)
buffer: VecDeque<BufferEntry>, | ||
curr_idx: usize, | ||
} | ||
|
||
impl LagState { | ||
pub fn new(frame: &Frame) -> Self { | ||
let offset = must_match!(frame, Frame::Offset(offset) if *offset < 0 => -offset as usize); | ||
let offset = must_match!(frame, Frame::Rows(FrameBound::Preceding(offset), FrameBound::CurrentRow) => *offset); |
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.
What's the difference between our must_match
and assert_matches
?
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.
Looks the same😄, will change to assert_matches
.
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
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.
👍
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
Signed-off-by: Richard Chien <stdrc@outlook.com>
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR
WindowBuffer
structure to maintain buffered entries for a window frame.AggregateState
which is aWindowState
to support aggregate function over window.Checklist For Contributors
[ ] I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features Sqlsmith: Sql feature generation #7934)../risedev check
(or alias,./risedev c
)Checklist For Reviewers
Documentation
Click here for Documentation
Types of user-facing changes
Please keep the types that apply to your changes, and remove the others.
Release note