-
Notifications
You must be signed in to change notification settings - Fork 574
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
fix(frontend): create mview on singleton upstream mview #4153
Conversation
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
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
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
@@ -78,6 +79,11 @@ impl BatchSeqScan { | |||
Distribution::Single | |||
} else { | |||
match self.logical.distribution_key() { | |||
// FIXME: Should be `Single` if no distribution 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.
Opened #4164 for this.
assert!( | ||
!key.is_empty(), | ||
"hash key should not be empty, use `Single` instead" | ||
); |
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.
Opened #4165 for this.
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
// fragment in the downstream mview. Remove this when we refactor the fragmenter. | ||
bool is_singleton = 6; |
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 desired way?
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.
We may directly operate on the Fragment
struct in the frontend instead of the protobuf struct, so that we may be able to directly find whether a fragment is a singleton or not instead of checking the dispatcher type.
Currently, we cannot check whether is_singleton
for the most upstream fragment since there's no exchange before it. That's why we need hacking for TopN
and Chain
. 😢
cc @st1page
// memorize table id for later use | ||
state | ||
.dependent_table_ids | ||
.insert(TableId::new(node.table_id)); | ||
current_fragment.is_singleton = node.is_singleton; |
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.
IIUC, the flag node.is_singleton
for chain_node is alwasy true? Or it depends on the whether the upstream mview is singleton or not.
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.
Or it depends on the whether the upstream mview is singleton or not.
✔️
@@ -467,6 +467,7 @@ where | |||
for fragment in fragment_graph.fragments.values_mut() { | |||
mview_count += fill_mview_id(fragment.node.as_mut().unwrap(), mview_id); | |||
} | |||
let fragment_graph = fragment_graph; |
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.
let fragment_graph = fragment_graph; |
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's for making it immutable, so we won't fear that the variable will unexpectedly change after this line. 🥺
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
Codecov Report
@@ Coverage Diff @@
## main #4153 +/- ##
==========================================
+ Coverage 73.92% 73.96% +0.03%
==========================================
Files 839 839
Lines 119199 119202 +3
==========================================
+ Hits 88121 88165 +44
+ Misses 31078 31037 -41
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
…bs#4153) * use singleton distribution on stream scan Signed-off-by: Bugen Zhao <i@bugenzhao.com> * refine parallelism allocation Signed-off-by: Bugen Zhao <i@bugenzhao.com> * fix the bug Signed-off-by: Bugen Zhao <i@bugenzhao.com> * fix local mode Signed-off-by: Bugen Zhao <i@bugenzhao.com> * refine docs Signed-off-by: Bugen Zhao <i@bugenzhao.com> * disable batch fix Signed-off-by: Bugen Zhao <i@bugenzhao.com> * add tests Signed-off-by: Bugen Zhao <i@bugenzhao.com> * fix tests Signed-off-by: Bugen Zhao <i@bugenzhao.com> * fix distributed e2e Signed-off-by: Bugen Zhao <i@bugenzhao.com> * remove logging Signed-off-by: Bugen Zhao <i@bugenzhao.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
I hereby agree to the terms of the Singularity Data, Inc. Contributor License Agreement.
What's changed and what's your intention?
This PR fixes that we cannot create an mview on a singleton upstream mview. There're several reasons.
StreamTableScan
does not check whether the distribution key of upstream mview is empty, and always useHashShard
distribution.is_singleton = false
regardless of the distribution.Output
, it needs the downstream address to decide whether we need aRemoteOutput
.This PR also includes some style refinement of the stream manager. 💦
Checklist
./risedev check
(or alias,./risedev c
)Refer to a related PR or issue link (optional)