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

   ## Which issue does this PR close?
   
   - Related to apache/datafusion-comet#4131.
   
   ## Rationale for this change
   
   `TrivialLastValueAccumulator::merge_batch` filtered out unset states but 
then read row `0` from the remaining value array. As a result, merging multiple 
`LAST_VALUE` partial states returned the first valid state instead of the last 
one.
   
   ## What changes are included in this PR?
   
   - Select the final valid state row when merging unordered `LAST_VALUE` 
states.
   - Extend the existing merge test to verify the evaluated result.
   
   ## Are these changes tested?
   
   Yes:
   
   ```shell
   cargo test -p datafusion-functions-aggregate 
test_first_last_state_after_merge


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