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

Aggregate function with expr panics when from table is absent #1316

Closed
capkurmagati opened this issue Nov 16, 2021 · 0 comments · Fixed by #1319
Closed

Aggregate function with expr panics when from table is absent #1316

capkurmagati opened this issue Nov 16, 2021 · 0 comments · Fixed by #1319
Labels
bug Something isn't working

Comments

@capkurmagati
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.
Aggregate function with expr panics when from table is absent

To Reproduce
Steps to reproduce the behavior:

DataFusion CLI v5.1.0-SNAPSHOT

❯ select count(1);
+-----------------+
| COUNT(UInt8(1)) |
+-----------------+
| 1               |
+-----------------+
1 row in set. Query took 0.005 seconds.
❯ select count(1 + 1);
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/jason/.cargo/registry/src/github.com-1ecc6299db9ec823/arrow-6.1.0/src/datatypes/schema.rs:165:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

❯ select count(null is null);
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/jason/.cargo/registry/src/github.com-1ecc6299db9ec823/arrow-6.1.0/src/datatypes/schema.rs:165:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

❯ select count(now());
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /Users/jason/.cargo/registry/src/github.com-1ecc6299db9ec823/arrow-6.1.0/src/datatypes/schema.rs:165:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior
A clear and concise description of what you expected to happen.

postgres=# select count(1 + 1);
 count
-------
     1
(1 row)

postgres=# select count(null is null);
 count
-------
     1
(1 row)

postgres=# select count(now());
 count
-------
     1
(1 row)

Additional context
Add any other context about the problem here.

It doesn't panic when the source table exists.

cat /tmp/a.csv
1,2
3,4
5,6
❯ create external table a(x int, y int) stored as csv location '/tmp/a.csv';
0 rows in set. Query took 0.031 seconds.
❯ select count(x) from a;
+------------+
| COUNT(a.x) |
+------------+
| 3          |
+------------+
1 row in set. Query took 0.041 seconds.
❯ select count(x + 1) from a;
+--------------------------+
| COUNT(a.x Plus Int64(1)) |
+--------------------------+
| 3                        |
+--------------------------+
1 row in set. Query took 0.019 seconds.
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