alamb opened a new issue, #15881:
URL: https://github.com/apache/datafusion/issues/15881
### Describe the bug
When invalid arguments are passed to `generate_series` it generates internal
errors rather than normal execution errorrs
Also the errors are not clear how to fix the issue
### To Reproduce
```
> select generate_series(1, '2024-01-01', '2025-01-02');
Internal error: could not cast array of type Date32 to
arrow_array::array::primitive_array::PrimitiveArray<arrow_array::types::Int64Type>.
This was likely caused by a bug in DataFusion's code and we would welcome
that you file an bug report in our issue tracker
```
Here is a similar one:
```
> select unnest(generate_series('2024-01-01'::timestamp, '2025-01-02',
interval '1 day'));
Internal error: Unexpected argument type for GENERATE_SERIES : Date32.
```
### Expected behavior
I think this should just be a normal error (not an internal error)
According to the docs,
https://datafusion.apache.org/user-guide/sql/scalar_functions.html#generate-series
the first and second argument must be the same
> Arguments
> start: Start of the series. Ints, timestamps, dates or string types that
can be coerced to Date32 are supported.
> end: End of the series (included). Type must be the same as start.
> step: Increase by step (can not be 0). Steps less than a day are supported
only for timestamp ranges.
### Additional context
_No response_
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]