Skip to content
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

batch: singleton seq scan on local mode #4164

Closed
BugenZhao opened this issue Jul 26, 2022 · 5 comments · Fixed by #5907
Closed

batch: singleton seq scan on local mode #4164

BugenZhao opened this issue Jul 26, 2022 · 5 comments · Fixed by #5907
Assignees
Labels
component/batch Batch related related issue. help wanted Issues that need help from contributors type/bug Something isn't working

Comments

@BugenZhao
Copy link
Member

BugenZhao commented Jul 26, 2022

Describe the bug
Currently, when scanning from a singleton mview, we still schedule multiple scans.

To Reproduce

create table t (v int);
create materialized view mv as select v from t order by v limit 10;

explain verbose select * from mv;
                          QUERY PLAN                          
--------------------------------------------------------------
 BatchExchange { order: [], dist: [Single] }
   BatchScan { table: mv, columns: [mv.v], distribution: [] }

The distribution is [], that is, HashShard with empty keys. This is incorrect, we should use Single instead.

https://github.com/singularity-data/risingwave/blob/eb8109fc122ad51a8ccfcf4fc1efc03d79bfdb0a/src/frontend/src/optimizer/plan_node/batch_seq_scan.rs#L75-L93

#4153 introduced a fix while commented out, since it won't work on local mode now. We should fix this.

Expected behavior

                          QUERY PLAN                          
---------------------------------------------------------------
 BatchScan { table: mv, columns: [mv.v], distribution: Single }

Additional context
#4153 fixes the similar issue of StreamScan.
#3269 is related.

@BugenZhao BugenZhao added type/bug Something isn't working help wanted Issues that need help from contributors component/batch Batch related related issue. labels Jul 26, 2022
@BugenZhao
Copy link
Member Author

@xxchan Could you please help to take a look?

@BowenXiao1999
Copy link
Contributor

Well this problem is hard to find cuz the execution works fine and we can get the results. 👍

@BowenXiao1999
Copy link
Contributor

BowenXiao1999 commented Jul 26, 2022

Agreed that HashShard(vec![]) should not be a valid expression in our system.

@liurenjie1024
Copy link
Contributor

This is a known issue, another case the table scan maybe singleton is partition prunning.

@xxchan xxchan self-assigned this Aug 17, 2022
@liurenjie1024
Copy link
Contributor

I think we should fix it in fragmenter, since we will move root fragment execution into frontend later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/batch Batch related related issue. help wanted Issues that need help from contributors type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants