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

Panic in a query with NATURAL JOIN (SQLancer) #14015

Open
2010YOUY01 opened this issue Jan 6, 2025 · 2 comments
Open

Panic in a query with NATURAL JOIN (SQLancer) #14015

2010YOUY01 opened this issue Jan 6, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@2010YOUY01
Copy link
Contributor

Describe the bug

See reproducer in datafusion-cli (compiled from latest main, commit hash 3f4297f)

DataFusion CLI v44.0.0
> create table t1(v1 int, v2 int);
0 row(s) fetched.
Elapsed 0.021 seconds.

> select v1 from t1 as tt1 natural join t1 as tt2 group by v1 order by v2;
thread 'main' panicked at /Users/yongting/Code/datafusion/datafusion/expr/src/logical_plan/plan.rs:909:17:
assertion `left == right` failed
  left: 3
 right: 2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce

No response

Expected behavior

column reference v2 in order by clause is invalid, the query should return an error instead like

> select v1 from t1 group by v1 order by v2;
Schema error: No field named t1.v2. Valid fields are t1.v1.

Additional context

Found by SQLancer #11030

@2010YOUY01 2010YOUY01 added the bug Something isn't working label Jan 6, 2025
@jonahgao
Copy link
Member

jonahgao commented Jan 6, 2025

Panic occurred in add_missing_columns. Might be related to #10326

I plan to investigate it further, thank you @2010YOUY01 for reporting it.

@jonahgao jonahgao self-assigned this Jan 6, 2025
@alamb
Copy link
Contributor

alamb commented Jan 6, 2025

THanks @2010YOUY01 and @jonahgao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants