capkurmagati opened a new issue #1316:
URL: https://github.com/apache/arrow-datafusion/issues/1316


   **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.
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to