pub struct PartitionSpec { /* private fields */ }Expand description
Partition spec that defines how to produce a tuple of partition values from a record.
A PartitionSpec is originally obtained by binding an UnboundPartitionSpec to a schema and is
only guaranteed to be valid for that schema. The main difference between PartitionSpec and
UnboundPartitionSpec is that the former has field ids assigned,
while field ids are optional for UnboundPartitionSpec.
Implementations§
Source§impl PartitionSpec
impl PartitionSpec
Sourcepub fn builder(schema: impl Into<SchemaRef>) -> PartitionSpecBuilder
pub fn builder(schema: impl Into<SchemaRef>) -> PartitionSpecBuilder
Create a new partition spec builder with the given schema.
Sourcepub fn fields(&self) -> &[PartitionField]
pub fn fields(&self) -> &[PartitionField]
Fields of the partition spec
Sourcepub fn unpartition_spec() -> Self
pub fn unpartition_spec() -> Self
Get a new unpartitioned partition spec
Sourcepub fn is_unpartitioned(&self) -> bool
pub fn is_unpartitioned(&self) -> bool
Returns if the partition spec is unpartitioned.
A PartitionSpec is unpartitioned if it has no fields or all fields are Transform::Void transform.
Sourcepub fn partition_type(&self, schema: &Schema) -> Result<StructType>
pub fn partition_type(&self, schema: &Schema) -> Result<StructType>
Returns the partition type of this partition spec.
Sourcepub fn into_unbound(self) -> UnboundPartitionSpec
pub fn into_unbound(self) -> UnboundPartitionSpec
Convert to unbound partition spec
Sourcepub fn with_spec_id(self, spec_id: i32) -> Self
pub fn with_spec_id(self, spec_id: i32) -> Self
Change the spec id of the partition spec
Sourcepub fn has_sequential_ids(&self) -> bool
pub fn has_sequential_ids(&self) -> bool
Check if this partition spec has sequential partition ids. Sequential ids start from 1000 and increment by 1 for each field. This is required for spec version 1
Sourcepub fn highest_field_id(&self) -> Option<i32>
pub fn highest_field_id(&self) -> Option<i32>
Get the highest field id in the partition spec.
Sourcepub fn is_compatible_with(&self, other: &PartitionSpec) -> bool
pub fn is_compatible_with(&self, other: &PartitionSpec) -> bool
Check if this partition spec is compatible with another partition spec.
Returns true if the partition spec is equal to the other spec with partition field ids ignored and spec_id ignored. The following must be identical:
- The number of fields
- Field order
- Field names
- Source column ids
- Transforms
Sourcepub fn partition_to_path(&self, data: &Struct, schema: SchemaRef) -> String
pub fn partition_to_path(&self, data: &Struct, schema: SchemaRef) -> String
Returns partition path string containing partition type and partition value as key-value pairs.
Trait Implementations§
Source§impl Clone for PartitionSpec
impl Clone for PartitionSpec
Source§fn clone(&self) -> PartitionSpec
fn clone(&self) -> PartitionSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PartitionSpec
impl Debug for PartitionSpec
Source§impl<'de> Deserialize<'de> for PartitionSpec
impl<'de> Deserialize<'de> for PartitionSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<PartitionSpec> for UnboundPartitionSpec
impl From<PartitionSpec> for UnboundPartitionSpec
Source§fn from(spec: PartitionSpec) -> Self
fn from(spec: PartitionSpec) -> Self
Source§impl PartialEq for PartitionSpec
impl PartialEq for PartitionSpec
Source§impl Serialize for PartitionSpec
impl Serialize for PartitionSpec
impl Eq for PartitionSpec
impl StructuralPartialEq for PartitionSpec
Auto Trait Implementations§
impl Freeze for PartitionSpec
impl RefUnwindSafe for PartitionSpec
impl Send for PartitionSpec
impl Sync for PartitionSpec
impl Unpin for PartitionSpec
impl UnwindSafe for PartitionSpec
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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,
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,
Any.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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