Rich-T-kid commented on code in PR #12088:
URL: https://github.com/apache/arrow-rs/pull/12088#discussion_r4486195637
##########
arrow-array/src/array/mod.rs:
##########
@@ -432,6 +432,18 @@ pub unsafe trait Array: std::fmt::Debug + Send + Sync {
/// A reference-counted reference to a generic `Array`
pub type ArrayRef = Arc<dyn Array>;
+/// Returns `true` if two child value arrays have the same layout and backing
buffers.
+///
+/// This is useful for recognizing shared values in [`DictionaryArray`] and
[`RunArray`].
+/// It first checks whether the [`ArrayRef`]s point to the same allocation,
then falls back
+/// to [`ArrayData::ptr_eq`] to recognize shallow clones such as
`Arc::new(array.clone())`.
+///
+/// This checks storage identity, not logical equality: arrays with equal
values but
+/// different buffers return `false`.
+pub fn child_values_ptr_eq(left: &ArrayRef, right: &ArrayRef) -> bool {
Review Comment:
Yeah, that’s a fair point. Initially, the logic was only in #11743, but I
thought it might be useful elsewhere for other dictionary work. I may have
jumped the gun. I’ll refactor this, and if there are genuinely other use cases,
we can make it a broader public change.
--
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]