-
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(optimizer): add columns_monotonicity
field for PlanNode
#17600
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
columns_monotonicity
field for PlanNodecolumns_monotonicity
field for PlanNode
columns_monotonicity
field for PlanNodecolumns_monotonicity
field for PlanNode
fa356fc
to
2d4e7b2
Compare
9f264c4
to
6b9feea
Compare
2d4e7b2
to
d40c9c9
Compare
d40c9c9
to
5f46d7a
Compare
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.
generally LGTM
986df96
to
48d85fd
Compare
043bb8a
to
3320e87
Compare
48d85fd
to
bbbdd0e
Compare
bbbdd0e
to
ac30c1f
Compare
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.
Any background about what makes you want to resurrect this work?
@@ -271,3 +292,53 @@ impl MonotonicityAnalyzer { | |||
Inherent(Unknown) | |||
} | |||
} | |||
|
|||
#[derive(Debug, Default, Clone, PartialEq, Eq, Hash)] | |||
pub struct MonotonicityMap(BTreeMap<usize, Monotonicity>); |
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.
Can you add comments? The meaning of the BTreeMap is not clear to me. Is it sth like [Monotonicity; num_cols]
?
impl IndexMut<usize> for MonotonicityMap { | ||
fn index_mut(&mut self, idx: usize) -> &mut Self::Output { | ||
self.0.entry(idx).or_insert(Monotonicity::Unknown) | ||
} | ||
} |
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.
If you want to maintain the invariant of not containing Unknown
, I think we should not implement IndexMut
, and stick to insert
, because you will be able to m[i]=Unknown
.
src/frontend/src/optimizer/plan_node/stream_eowc_over_window.rs
Outdated
Show resolved
Hide resolved
false, | ||
false, | ||
watermark_columns, | ||
MonotonicityMap::new(), |
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.
Are TopN's order columns monotonic?
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.
I'm afraid not. Currently I tend to define monotonicity as a property ignoring Op
s. While you did remind me that TopN can produce watermarks.
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]>
ac30c1f
to
15a38e7
Compare
Signed-off-by: Richard Chien <[email protected]>
Signed-off-by: Richard Chien <[email protected]>
Three reasons:
|
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
Following #17554, this PR adds a new field
columns_monotonicity
toplan_base::StreamExtra
, and derives the property in each stream node. As a result, we can use the property as a hint to optimize algorithm, or require input nodes to have a specific variant of property.Fixes #13983.
Checklist
./risedev check
(or alias,./risedev c
)Documentation
Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.