Dandandan commented on code in PR #19975:
URL: https://github.com/apache/datafusion/pull/19975#discussion_r2724253386
##########
datafusion/physical-expr-common/src/binary_view_map.rs:
##########
@@ -267,24 +272,32 @@ where
};
observe_payload_fn(payload);
continue;
- };
+ }
+
+ // Extract length from the view (first 4 bytes of u128)
+ // This is used for potential future optimizations
+ let _len = (view_u128 & 0xFFFFFFFF) as u32;
- // get the value as bytes
- let value: &[u8] = value.as_ref();
+ // Get the input value - Arrow's value() method is already
optimized
+ // to handle inline strings efficiently
+ let input_value: &[u8] = values.value(i).as_ref();
let entry = self.map.find_mut(hash, |header| {
if header.hash != hash {
return false;
}
- let v = self.builder.get_value(header.view_idx);
- v == value
+ // Compare stored value with input value
+ let stored_value = self.builder.get_value(header.view_idx);
+ stored_value == input_value
});
let payload = if let Some(entry) = entry {
entry.payload
} else {
// no existing value, make a new one.
+ // Only dereference bytes here when we actually need to insert
+ let value: &[u8] = values.value(i).as_ref();
Review Comment:
We should avoid this for inlined values (and it's the same as above
`input_value`, so now it does it twice.
--
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]