ClSlaid commented on code in PR #5707:
URL: https://github.com/apache/arrow-rs/pull/5707#discussion_r1588560902
##########
arrow-array/src/array/byte_view_array.rs:
##########
@@ -482,6 +592,59 @@ impl From<Vec<Option<String>>> for StringViewArray {
}
}
+/// A helper struct that used to check if the array is compact view
+///
+/// The checker is lazy and will not check the array until `finish` is called.
+///
+/// This is based on the assumption that the array will most likely to be not
compact,
+/// so it is likely to scan the entire array.
+///
+/// Then it is better to do the check at once, rather than doing it for each
accumulate operation.
+struct CompactChecker {
+ length: usize,
+ intervals: BTreeMap<usize, usize>,
+}
Review Comment:
I wonder if there is a better algorithm for this.
It's the most straightforward and simplest way I could come up with, though.
--
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]