pub struct PartitionValueCalculator { /* private fields */ }Expand description
Calculator for partition values in Iceberg tables.
This struct handles the projection of source columns and application of partition transforms to compute partition values for a given record batch.
Implementations§
Source§impl PartitionValueCalculator
impl PartitionValueCalculator
Sourcepub fn try_new(
partition_spec: &PartitionSpec,
table_schema: &Schema,
) -> Result<Self>
pub fn try_new( partition_spec: &PartitionSpec, table_schema: &Schema, ) -> Result<Self>
Create a new PartitionValueCalculator.
§Arguments
partition_spec- The partition specificationtable_schema- The Iceberg table schema
§Returns
Returns a new PartitionValueCalculator instance or an error if initialization fails.
§Errors
Returns an error if:
- The partition spec is unpartitioned
- Transform function creation fails
- Projector initialization fails
Sourcepub fn partition_type(&self) -> &StructType
pub fn partition_type(&self) -> &StructType
Get the partition type as an Iceberg StructType.
Sourcepub fn partition_arrow_type(&self) -> &DataType
pub fn partition_arrow_type(&self) -> &DataType
Get the partition type as an Arrow DataType.
Sourcepub fn calculate(&self, batch: &RecordBatch) -> Result<ArrayRef>
pub fn calculate(&self, batch: &RecordBatch) -> Result<ArrayRef>
Calculate partition values for a record batch.
This method:
- Projects the source columns from the batch
- Applies partition transforms to each source column
- Constructs a StructArray containing the partition values
§Arguments
batch- The record batch to calculate partition values for
§Returns
Returns an ArrayRef containing a StructArray of partition values, or an error if calculation fails.
§Errors
Returns an error if:
- Column projection fails
- Transform application fails
- StructArray construction fails
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PartitionValueCalculator
impl !RefUnwindSafe for PartitionValueCalculator
impl Send for PartitionValueCalculator
impl Sync for PartitionValueCalculator
impl Unpin for PartitionValueCalculator
impl !UnwindSafe for PartitionValueCalculator
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more