You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query #496
Describe the bug
A malformed query generates a panic rather than an error
To Reproduce
echo "true" > /tmp/foo.csv
cargo run -p datafusion-cli --no-default-features
Then run select count(distinct) from foo; via sql:
> CREATE EXTERNAL TABLE foo(bar boolean)
STORED AS CSV
LOCATION '/tmp/foo.csv';
0 rows in set. Query took 0 seconds.
> select count(distinct) from foo;
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', datafusion/src/physical_plan/aggregates.rs:116:15
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Expected behavior
I expect an error about "no column specified for count distinct" rather than a panic
Thanks @jgoday ! Perhaps you can make the error a little more specific -- like "no arguments passed to aggregate {}" or something. But the location looks reasonable
Activity
jgoday commentedon Jun 3, 2021
Hi @alamb Can I try this ?
Should be enough to check if the coerced args in the aggregation returns no result (in physical_plan/aggregates) ?
alamb commentedon Jun 3, 2021
Thanks @jgoday ! Perhaps you can make the error a little more specific -- like "no arguments passed to aggregate {}" or something. But the location looks reasonable
jgoday commentedon Jun 4, 2021
Thank you @alamb. I have created a PR #505 for this.
How about this error message?
alamb commentedon Jun 4, 2021
I think "Invalid or wrong number of arguments passed to aggregate: {}" is probably sufficient
add bit_and,bit_or,bit_xor,bool_add,bool_or (apache#496)
Bump object_store upper bound from 0.12.2 to 0.12.5
Bump object_store upper bound to 0.12.5 (#408)
Bump object_store upper bound to 0.12.5 (#408)