alamb opened a new issue, #11922:
URL: https://github.com/apache/datafusion/issues/11922

   ### Describe the bug
   
   When running a query like 
   
   ```sql
   select generate_series(start, '1993-03-01', INTERVAL '1 year') from 
date_table;
   ```
   
   You get an error:
   
   > DataFusion error: Internal error: could not cast value to 
arrow_array::array::primitive_array::PrimitiveArray<arrow_array::types::Date32Type>.
   > 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
   
   ### To Reproduce
   
   ```sql
   DataFusion CLI v40.0.0
   > CREATE TABLE date_table(
     start DATE,
     stop DATE,
     step INTERVAL
   ) AS VALUES
     (DATE '1992-01-01', DATE '1993-01-02', INTERVAL '1' MONTH),
     (DATE '1993-02-01', DATE '1993-01-01', INTERVAL '-1' DAY),
     (DATE '1989-04-01', DATE '1993-03-01', INTERVAL '1' YEAR);
   0 row(s) fetched.
   Elapsed 0.016 seconds.
   
   > select generate_series(start, '1993-03-01', INTERVAL '1 year') from 
date_table;
   
   Internal error: could not cast value to 
arrow_array::array::primitive_array::PrimitiveArray<arrow_array::types::Date32Type>.
   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
   ```
   
   
   
   ### Expected behavior
   
   I expect you get the same answer as if you explicitly cast the second 
argument to `date`:
   
   ```sql
   > select generate_series(start, '1993-03-01'::DATE, INTERVAL '1 year') from 
date_table;
   
+-------------------------------------------------------------------------------------------------------------------------------------------+
   | 
generate_series(date_table.start,Utf8("1993-03-01"),IntervalMonthDayNano("IntervalMonthDayNano
 { months: 12, days: 0, nanoseconds: 0 }")) |
   
+-------------------------------------------------------------------------------------------------------------------------------------------+
   | [1992-01-01, 1993-01-01]                                                   
                                                               |
   | [1993-02-01]                                                               
                                                               |
   | [1989-04-01, 1990-04-01, 1991-04-01, 1992-04-01]                           
                                                               |
   
+-------------------------------------------------------------------------------------------------------------------------------------------+
   3 row(s) fetched.
   Elapsed 0.001 seconds.
   ```
   
   ### 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]

Reply via email to