You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/06/03 15:49:13 UTC

[GitHub] [arrow-datafusion] alamb opened a new issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

alamb opened a new issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/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 this 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


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] jgoday commented on issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

Posted by GitBox <gi...@apache.org>.
jgoday commented on issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/496#issuecomment-854118770


   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) ?
   ```rust
   let arg = coerce(args, input_schema, &signature(fun))?;
   if arg.len() == 0 {
       return Err(DataFusionError::Plan(format!(
           "Invalid aggregation '{}'",
           name,
       )));
   }
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb closed issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

Posted by GitBox <gi...@apache.org>.
alamb closed issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/496


   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb commented on issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

Posted by GitBox <gi...@apache.org>.
alamb commented on issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/496#issuecomment-854992938


   I think "Invalid or wrong number of arguments passed to aggregate: {}" is probably sufficient


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb edited a comment on issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

Posted by GitBox <gi...@apache.org>.
alamb edited a comment on issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/496#issuecomment-854170809


   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


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb edited a comment on issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

Posted by GitBox <gi...@apache.org>.
alamb edited a comment on issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/496#issuecomment-854170809


   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


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb commented on issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

Posted by GitBox <gi...@apache.org>.
alamb commented on issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/496#issuecomment-854170809


   Thanks @jgoday ! Perhaps you can make the error a little more specific -- like "no arguments passed to aggregate {}" or something 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] alamb commented on issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

Posted by GitBox <gi...@apache.org>.
alamb commented on issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/496#issuecomment-854170809


   Thanks @jgoday ! Perhaps you can make the error a little more specific -- like "no arguments passed to aggregate {}" or something 


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] jgoday commented on issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

Posted by GitBox <gi...@apache.org>.
jgoday commented on issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/496#issuecomment-854118770


   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) ?
   ```rust
   let arg = coerce(args, input_schema, &signature(fun))?;
   if arg.len() == 0 {
       return Err(DataFusionError::Plan(format!(
           "Invalid aggregation '{}'",
           name,
       )));
   }
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow-datafusion] jgoday commented on issue #496: panic! 'index out of bounds: the len is 0 but the index is 0 with bad sql query

Posted by GitBox <gi...@apache.org>.
jgoday commented on issue #496:
URL: https://github.com/apache/arrow-datafusion/issues/496#issuecomment-854945352


   Thank you @alamb. I have created a PR #505 for this.
   How about this error message?
   ```
   Aggregate error. Invalid or wrong number of arguments passed to aggregate: {}
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org