mohitgurav20 commented on code in PR #27196:
URL: https://github.com/apache/datafusion/pull/27196#discussion_r4732217776


##########
datafusion/physical-plan/src/aggregates/order/partial.rs:
##########
@@ -87,15 +88,10 @@ enum State {
 }
 
 impl State {
-    fn heap_size(&self) -> usize {
+    fn heap_size(&self, ctx: &mut DFHeapSizeCtx) -> usize {
         match self {
-            State::Taken => 0,
-            State::Start => 0,
-            State::InProgress { group_key, .. } => group_key
-                .iter()
-                .map(|scalar_value| scalar_value.size())
-                .sum(),
-            State::Complete => 0,
+            State::InProgress { group_key, .. } => group_key.heap_size(ctx),

Review Comment:
   Good catch on the array header overcount sirr .  i switched back to scalar 
payload accounting via ScalarValue::size_of_vec(group_key) - 
size_of::<Vec<ScalarValue>>(), which counts the vector slots plus extra heap 
without charging the array descriptor twice. Added 
heap_size_no_double_count_for_struct_key to test a struct key with exact byte 
expectations



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