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

fix(planner): group by without aggr calls #500

Merged
merged 1 commit into from
Feb 19, 2022
Merged

fix(planner): group by without aggr calls #500

merged 1 commit into from
Feb 19, 2022

Conversation

xxchan
Copy link
Member

@xxchan xxchan commented Feb 18, 2022

try to fix #256

current result:

> create table t(id int, v1 int, v2 int, v3 int);
created]
> explain select id from t group by id;
PhysicalProjection: exprs [InputRef #0]
  PhysicalHashAgg: 0 agg calls
    PhysicalTableScan: table #0, columns [0], with_row_handler: false, is_sorted: false, expr: None
> explain select * from t group by id;
thread 'tokio-runtime-worker' panicked at 'column reference not found', src/optimizer/logical_plan_rewriter/input_ref_resolver.rs:30:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'failed to join query thread: JoinError::Panic(...)', src/main.rs:79:23

Signed-off-by: xxchan <xxchan22f@gmail.com>
@xxchan xxchan requested review from skyzh and st1page February 18, 2022 20:50
Comment on lines +78 to +83
# AggregateWithProjectionTest2
query II rowsort
select v2 from t group by v2
----
3
4
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is new test. Others are merged from select.test

@xxchan xxchan changed the title planner: fix group by without aggr calls fix(planner): group by without aggr calls Feb 18, 2022
Copy link
Member

@skyzh skyzh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

> explain select * from t group by id;
thread 'tokio-runtime-worker' panicked at 'column reference not found', src/optimizer/logical_plan_rewriter/input_ref_resolver.rs:30:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'failed to join query thread: JoinError::Panic(...)', src/main.rs:79:23

For this panic, we might need to create a new issue for that. Better to reject such query as we didn't apply aggregation functions on columns other than group keys.

@skyzh skyzh merged commit 7218cac into risinglightdb:main Feb 19, 2022
@xxchan xxchan deleted the groupby branch February 20, 2022 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug(Binder): wrong fields in query with group by.
2 participants