pub struct PartitionSpecBuilder { /* private fields */ }
Expand description
Create valid partition specs for a given schema.
Implementations§
Source§impl PartitionSpecBuilder
impl PartitionSpecBuilder
Sourcepub fn new(schema: impl Into<SchemaRef>) -> Self
pub fn new(schema: impl Into<SchemaRef>) -> Self
Create a new partition spec builder with the given schema.
Sourcepub fn new_from_unbound(
unbound: UnboundPartitionSpec,
schema: impl Into<SchemaRef>,
) -> Result<Self>
pub fn new_from_unbound( unbound: UnboundPartitionSpec, schema: impl Into<SchemaRef>, ) -> Result<Self>
Create a new partition spec builder from an existing unbound partition spec.
Sourcepub fn with_last_assigned_field_id(self, last_assigned_field_id: i32) -> Self
pub fn with_last_assigned_field_id(self, last_assigned_field_id: i32) -> Self
Set the last assigned field id for the partition spec.
Set this field when a new partition spec is created for an existing TableMetaData.
As field_id
must be unique in V2 metadata, this should be set to
the highest field id used previously.
Sourcepub fn with_spec_id(self, spec_id: i32) -> Self
pub fn with_spec_id(self, spec_id: i32) -> Self
Set the spec id for the partition spec.
Sourcepub fn add_partition_field(
self,
source_name: impl AsRef<str>,
target_name: impl Into<String>,
transform: Transform,
) -> Result<Self>
pub fn add_partition_field( self, source_name: impl AsRef<str>, target_name: impl Into<String>, transform: Transform, ) -> Result<Self>
Add a new partition field to the partition spec.
Sourcepub fn add_unbound_field(self, field: UnboundPartitionField) -> Result<Self>
pub fn add_unbound_field(self, field: UnboundPartitionField) -> Result<Self>
Add a new partition field to the partition spec.
If partition field id is set, it is used as the field id.
Otherwise, a new field_id
is assigned.
Sourcepub fn add_unbound_fields(
self,
fields: impl IntoIterator<Item = UnboundPartitionField>,
) -> Result<Self>
pub fn add_unbound_fields( self, fields: impl IntoIterator<Item = UnboundPartitionField>, ) -> Result<Self>
Wrapper around with_unbound_fields
to add multiple partition fields.
Sourcepub fn build(self) -> Result<PartitionSpec>
pub fn build(self) -> Result<PartitionSpec>
Build a bound partition spec with the given schema.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PartitionSpecBuilder
impl RefUnwindSafe for PartitionSpecBuilder
impl Send for PartitionSpecBuilder
impl Sync for PartitionSpecBuilder
impl Unpin for PartitionSpecBuilder
impl UnwindSafe for PartitionSpecBuilder
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
§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> ⓘ
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> ⓘ
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