Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions datafusion/functions/src/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use datafusion_common::cast::{
use datafusion_expr_common::columnar_value::ColumnarValue;

/// Trait abstracting concatenating string and binary collections.
pub(crate) trait ConcatBuilder {
pub trait ConcatBuilder {
fn write<const CHECK_VALID: bool>(
&mut self,
column: &ColumnarValueRef,
Expand All @@ -61,13 +61,13 @@ pub(crate) trait ConcatBuilder {
///
/// For the common "produce one `&str` per row" pattern, prefer
/// `GenericStringArrayBuilder` instead.
pub(crate) struct ConcatGenericStringBuilder<O: OffsetSizeTrait + ArrowNativeType> {
pub struct ConcatGenericStringBuilder<O: OffsetSizeTrait + ArrowNativeType> {
offsets_buffer: MutableBuffer,
value_buffer: MutableBuffer,
_phantom: PhantomData<O>,
}
pub(crate) type ConcatStringBuilder = ConcatGenericStringBuilder<i32>;
pub(crate) type ConcatLargeStringBuilder = ConcatGenericStringBuilder<i64>;
pub type ConcatStringBuilder = ConcatGenericStringBuilder<i32>;
pub type ConcatLargeStringBuilder = ConcatGenericStringBuilder<i64>;

impl<O: OffsetSizeTrait + ArrowNativeType> ConcatGenericStringBuilder<O> {
pub fn with_capacity(item_capacity: usize, data_capacity: usize) -> Self {
Expand Down Expand Up @@ -184,10 +184,12 @@ impl<O: OffsetSizeTrait + ArrowNativeType> ConcatBuilder
/// fragment) followed by a single `append_offset` to commit the row
/// as a single string view. The output null buffer is supplied by the caller
/// at `finish` time, avoiding per-row NULL handling work.
///
/// For the common "produce one `&str` per row" pattern, prefer
/// [`StringViewArrayBuilder`] instead.
pub(crate) struct ConcatStringViewBuilder {
//
// Add below to the doc comment if StringViewArrayBuilder is made public:
//
// For the common "produce one `&str` per row" pattern, prefer
// [`StringViewArrayBuilder`] instead.
pub struct ConcatStringViewBuilder {
views: Vec<u128>,
data: Vec<u8>,
block: Vec<u8>,
Expand Down Expand Up @@ -1217,7 +1219,7 @@ pub(crate) fn append_view(
}

#[derive(Debug)]
pub(crate) enum ColumnarValueRef<'a> {
pub enum ColumnarValueRef<'a> {
Scalar(&'a [u8]),
NullableArray(&'a StringArray),
NonNullableArray(&'a StringArray),
Expand Down