zhuqi-lucas commented on code in PR #7873:
URL: https://github.com/apache/arrow-rs/pull/7873#discussion_r2192158227
##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -473,13 +473,86 @@ impl<T: ByteViewType + ?Sized> GenericByteViewArray<T> {
/// Note: this function does not attempt to canonicalize / deduplicate
values. For this
/// feature see [`GenericByteViewBuilder::with_deduplicate_strings`].
pub fn gc(&self) -> Self {
- let mut builder =
GenericByteViewBuilder::<T>::with_capacity(self.len());
+ // 1) Read basic properties once
+ let len = self.len(); // number of elements
+ let views = self.views(); // raw u128 “view” values per slot
+ let nulls = self.nulls().cloned(); // reuse & clone existing null
bitmap
+
+ // 2) Calculate the total size of all non‑inline data
+ let mut total_large = 0;
+ if let Some(nbm) = &nulls {
+ for i in nbm.valid_indices() {
+ let raw_view: u128 = unsafe { *views.get_unchecked(i) };
+ let bv = ByteView::from(raw_view);
+ if bv.length > MAX_INLINE_VIEW_LEN {
+ total_large += bv.length as usize;
+ }
+ }
+ } else {
+ for i in 0..len {
Review Comment:
Addressed in latest PR, thanks @Dandandan.
--
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]