-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working