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 when an invalid expression in GROUP BY clause (SQLancer) #12699

Closed
2010YOUY01 opened this issue Oct 1, 2024 · 0 comments · Fixed by #12837
Closed

Panic when an invalid expression in GROUP BY clause (SQLancer) #12699

2010YOUY01 opened this issue Oct 1, 2024 · 0 comments · Fixed by #12837
Labels
bug Something isn't working

Comments

@2010YOUY01
Copy link
Contributor

2010YOUY01 commented Oct 1, 2024

Describe the bug

See the reproducer in datafusion-cli (compiled from the latest main, commit 0242767)

DataFusion CLI v42.0.0
> select 1 group by substr('' || false);

thread 'main' panicked at /Users/yongting/Desktop/code/my_datafusion/arrow-datafusion/datafusion/functions/src/unicode/substr.rs:113:74:
index out of bounds: the len is 1 but the index is 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This can also be triggered if substr is in WHERE clause

> select 1 where substr('' || false);
thread 'main' panicked at /Users/yongting/Desktop/code/my_datafusion/arrow-datafusion/datafusion/functions/src/unicode/substr.rs:113:74:
index out of bounds: the len is 1 but the index is 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce

No response

Expected behavior

substr() function expression is provided with invalid argument(it's not allowed to take only 1 argument), so the query should return the planning error

Additional context

Found by SQLancer #11030

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

Successfully merging a pull request may close this issue.

1 participant