zhuqi-lucas commented on code in PR #23628:
URL: https://github.com/apache/datafusion/pull/23628#discussion_r3699069253


##########
datafusion/functions-aggregate/src/first_last.rs:
##########
@@ -171,6 +171,23 @@ fn create_groups_accumulator(
             BytesValueState::try_new(data_type.clone())?,
         ),
 
+        // Nested / composite types fall through to a generic 
ScalarValue-backed
+        // state. Slower per-batch than the primitive/bytes fast paths but 
still
+        // avoids the per-row ScalarValue churn of the per-group `Accumulator`
+        // path: winner extraction happens once per group per batch, not once
+        // per candidate row.
+        DataType::List(_)

Review Comment:
   Updated:
   
   Thanks for the suggestion @kosiew! Added `first_last_nested.slt` with 
SQL-level `first_value`/`last_value` coverage for **Struct** and **Map** 
payloads. It runs under the SLT runner's `target_partitions=4`, so the 
two-phase `Partial -> FinalPartitioned` aggregate round-trips the nested 
intermediate state through `state()`/`merge_batch()` across the partition 
boundary — the distributed merge shape you mentioned, for the nested types 
beyond the existing List coverage.



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