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

   ### Describe the bug
   
   These queries will give errors or incorrect results.
   
   ### To Reproduce
   
   Run queries in CLI:
   ```sh
   DataFusion CLI v38.0.0
   
   > select array_slice([1,2,3], 1, NULL);
   Internal error: could not cast value 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
   
   > select array_slice([1,2,3], -100, 1) r;
   +----+
   | r  |
   +----+
   | [] |
   +----+
   1 row(s) fetched.
   Elapsed 0.006 seconds.
   
   > select array_slice([1,2,3], 1, 1, -1) r;
   +----+
   | r  |
   +----+
   | [] |
   +----+
   ```
   
   ### Expected behavior
   
   The results of DuckDB look correct to me.
   ```sh
   v0.10.3-dev779 d26007417b
   
   D select array_slice([1,2,3], 1, NULL);
   ┌────────────────────────────────────────────────┐
   │ array_slice(main.list_value(1, 2, 3), 1, NULL) │
   │                    int32[]                     │
   ├────────────────────────────────────────────────┤
   │                                                │
   └────────────────────────────────────────────────┘
   D select array_slice([1,2,3], -100, 1);
   ┌────────────────────────────────────────────────┐
   │ array_slice(main.list_value(1, 2, 3), -100, 1) │
   │                    int32[]                     │
   ├────────────────────────────────────────────────┤
   │ [1]                                            │
   └────────────────────────────────────────────────┘
   D select array_slice([1,2,3], 1, 1, -1) r;
   ┌─────────┐
   │    r    │
   │ int32[] │
   ├─────────┤
   │ [1]     │
   └─────────┘
   ```
   
   ### Additional context
   


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