Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ArrayAccessor, Iterator, Extend and benches for string run builder #3583

Closed
wants to merge 20 commits into from
Closed
18 changes: 18 additions & 0 deletions arrow-array/src/array/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ pub use struct_array::*;
mod union_array;
pub use union_array::*;

mod run_array;
pub use run_array::*;

/// Trait for dealing with different types of array at runtime when the type of the
/// array is not known in advance.
pub trait Array: std::fmt::Debug + Send + Sync {
Expand Down Expand Up @@ -579,6 +582,20 @@ pub fn make_array(data: ArrayData) -> ArrayRef {
}
dt => panic!("Unexpected dictionary key type {:?}", dt),
},
DataType::RunEndEncoded(ref run_ends_type, _) => {
match run_ends_type.data_type() {
DataType::Int16 => {
Arc::new(RunArray::<Int16Type>::from(data)) as ArrayRef
}
DataType::Int32 => {
Arc::new(RunArray::<Int32Type>::from(data)) as ArrayRef
}
DataType::Int64 => {
Arc::new(RunArray::<Int64Type>::from(data)) as ArrayRef
}
dt => panic!("Unexpected data type for run_ends array {:?}", dt),
}
}
DataType::Null => Arc::new(NullArray::from(data)) as ArrayRef,
DataType::Decimal128(_, _) => Arc::new(Decimal128Array::from(data)) as ArrayRef,
DataType::Decimal256(_, _) => Arc::new(Decimal256Array::from(data)) as ArrayRef,
Expand Down Expand Up @@ -737,6 +754,7 @@ pub fn new_null_array(data_type: &DataType, length: usize) -> ArrayRef {
new_null_sized_decimal(data_type, length, std::mem::size_of::<i128>())
}
DataType::Decimal256(_, _) => new_null_sized_decimal(data_type, length, 32),
DataType::RunEndEncoded(_, _) => todo!(),
}
}

Expand Down
Loading