Dandandan commented on code in PR #8951:
URL: https://github.com/apache/arrow-rs/pull/8951#discussion_r2702243507
##########
arrow-select/src/coalesce/byte_view.rs:
##########
@@ -279,18 +280,34 @@ impl<B: ByteViewType> InProgressByteViewArray<B> {
}
impl<B: ByteViewType> InProgressArray for InProgressByteViewArray<B> {
- fn set_source(&mut self, source: Option<ArrayRef>) {
+ fn set_source(&mut self, source: Option<ArrayRef>, selectivity:
Option<f64>) {
self.source = source.map(|array| {
let s = array.as_byte_view::<B>();
let (need_gc, ideal_buffer_size) = if s.data_buffers().is_empty() {
(false, 0)
} else {
+ // If selectivity is very low, it's almost certain that we
want to GC
+ // because we are only taking a tiny fraction of the data.
+ // In this case, we avoid the expensive O(N)
total_buffer_bytes_used() call.
+ //
+ // We use a threshold of 0.1 (10% selectivity).
+ if let Some(sel) = selectivity {
+ if sel < 0.1 {
Review Comment:
Probably use 0.5 to make it sort of equivalent to the heuristic below?
--
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]