Skip to content

panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query #496

@alamb

Description

@alamb

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions