timsaucer opened a new pull request, #10329:
URL: https://github.com/apache/datafusion/pull/10329

   This PR resolves an issue in which we get a panic attempting to concatenate 
empty arrays. This prevents lead and lag functions from working on these data 
types.
   
   ## Which issue does this PR close?
   
   Closes #10328.
   
   ## Rationale for this change
   
   When we call `WindowAggState::new` with a data type of a list, we will call 
`ScalarValue::try_from(out_type)?.to_array_of_size(0)` which in turn calls 
`list_to_array_of_size`. Within this function there is no check on the return 
size. It could be zero due to either an empty array input or a request for 0 
elements. In either of these conditions, you will get a panic from `concat`.
   
   ## What changes are included in this PR?
   
   This is a small change to check the return size. When zero it will just take 
an empty slice of the original array.
   
   ## Are these changes tested?
   
   I have included an expansion to an existing unit test to cover this. In my 
bug report I have also shown minimal example to reproduce the problem and the 
updated results from it's inclusion.
   
   ## Are there any user-facing changes?
   
   There are no user facing changes.
   


-- 
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: github-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to