alamb commented on code in PR #24229:
URL: https://github.com/apache/datafusion/pull/24229#discussion_r3752463714


##########
datafusion/physical-expr-common/src/binary_map.rs:
##########
@@ -264,6 +266,21 @@ where
         new_self
     }
 
+    fn insert_entry(
+        map: &mut hashbrown::hash_table::HashTable<Entry<O, V>>,
+        map_size: &mut usize,
+        entry: Entry<O, V>,
+    ) {
+        let capacity = map.capacity();
+        map.insert_accounted(entry, |entry| entry.hash, map_size);
+
+        // `insert_accounted` estimates growth from capacity. Keep `map_size`
+        // consistent with the exact allocation recorded by `new` after a 
resize.
+        if map.capacity() != capacity {

Review Comment:
   I think I missed how does `map_size` get report in the overall size? I 
expected to see a change in `size()` as well 🤔 



##########
datafusion/physical-expr-common/src/binary_map.rs:
##########
@@ -874,6 +883,33 @@ mod tests {
         assert!(size_after_values2 > total_strings1_len + total_strings2_len);
     }
 
+    #[test]
+    fn test_size_includes_hash_table_allocation() {
+        fn allocated_size(map: &ArrowBytesMap<i32, ()>) -> usize {

Review Comment:
   This isn't testing any public API 🤔 



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