jackylee-ch opened a new pull request, #25700:
URL: https://github.com/apache/datafusion/pull/25700

   ## Which issue does this PR close?
   
   - N/A
   
   ## Rationale for this change
   
   `to_char(<scalar datetime>, <format column>)` returns row 0's formatted 
string for every row. `to_char_array` formats each row, but the final `match 
args[0]` collapses the result to `result.value(0)` whenever `args[0]` is 
scalar, so a multi-row format column silently loses every row after the first.
   
   ## What changes are included in this PR?
   
   The scalar collapse now only applies when the result is a single row 
(`result.len() == 1`); otherwise the full array is returned. The single-row 
scalar behaviour is unchanged.
   
   ## What is the testing strategy for this PR?
   
   A unit test (scalar `Date32` + two-row format column) and a `timestamps.slt` 
case. Both fail on `main` (the result collapses to row 0) and pass with this 
change.
   
   ## Are there any user-facing changes?
   
   `to_char` with a scalar datetime and a format column now formats each row 
instead of repeating row 0. No API change.
   


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