Jefffrey commented on code in PR #11696:
URL: https://github.com/apache/arrow-rs/pull/11696#discussion_r4385895705
##########
arrow-select/src/coalesce.rs:
##########
@@ -165,6 +182,8 @@ pub struct BatchCoalescer {
in_progress_arrays: Vec<Box<dyn InProgressArray>>,
/// True if some column still needs the materialized filter path.
has_non_specialized_filter_columns: bool,
+ /// True if the schema requires the stricter byte-array density threshold.
Review Comment:
is this comment accurate? seems a bit confusing to me
##########
arrow-select/src/coalesce/byte.rs:
##########
@@ -0,0 +1,199 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use super::InProgressArray;
+use crate::filter::{FilterIndices, FilterPredicate, FilterSelection};
+use arrow_array::builder::GenericByteBuilder;
+use arrow_array::cast::AsArray;
+use arrow_array::types::ByteArrayType;
+use arrow_array::{Array, ArrayRef, GenericByteArray, OffsetSizeTrait};
+use arrow_buffer::ArrowNativeType;
+use arrow_schema::ArrowError;
+use std::sync::Arc;
+
+pub(crate) struct InProgressByteArray<T: ByteArrayType> {
+ source: Option<ArrayRef>,
+ batch_size: usize,
+ direct: GenericByteBuilder<T>,
+}
+
+impl<T: ByteArrayType> std::fmt::Debug for InProgressByteArray<T> {
+ fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+ f.debug_struct("InProgressByteArray")
+ .field(
+ "direct_rows",
+ &self.direct.offsets_slice().len().saturating_sub(1),
+ )
+ .finish()
+ }
+}
+
+impl<T: ByteArrayType> InProgressByteArray<T>
+where
+ T::Offset: OffsetSizeTrait,
+{
+ pub(crate) fn new(batch_size: usize) -> Self {
+ Self {
+ source: None,
+ batch_size,
+ direct: GenericByteBuilder::with_capacity(0, 0),
+ }
+ }
+
+ fn checked_values_len(current: usize, additional: usize) -> Result<usize,
ArrowError> {
+ let new_len = current
+ .checked_add(additional)
+ .ok_or(ArrowError::OffsetOverflowError(usize::MAX))?;
+ if new_len > T::Offset::MAX_OFFSET {
+ return Err(ArrowError::OffsetOverflowError(new_len));
+ }
+ Ok(new_len)
+ }
+
+ fn ensure_capacity(&mut self, source: &GenericByteArray<T>) {
Review Comment:
should we also bound this by the filter count, to avoid unnecessary
allocation?
--
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]