parquet::schema::types

Struct PrimitiveTypeBuilder

Source
pub struct PrimitiveTypeBuilder<'a> {
    name: &'a str,
    repetition: Repetition,
    physical_type: Type,
    converted_type: ConvertedType,
    logical_type: Option<LogicalType>,
    length: i32,
    precision: i32,
    scale: i32,
    id: Option<i32>,
}
Expand description

A builder for primitive types. All attributes are optional except the name and physical type. Note that if not specified explicitly, Repetition::OPTIONAL is used.

Fields§

§name: &'a str§repetition: Repetition§physical_type: Type§converted_type: ConvertedType§logical_type: Option<LogicalType>§length: i32§precision: i32§scale: i32§id: Option<i32>

Implementations§

Source§

impl<'a> PrimitiveTypeBuilder<'a>

Source

pub fn new(name: &'a str, physical_type: PhysicalType) -> Self

Creates new primitive type builder with provided field name and physical type.

Source

pub fn with_repetition(self, repetition: Repetition) -> Self

Sets Repetition for this field and returns itself.

Source

pub fn with_converted_type(self, converted_type: ConvertedType) -> Self

Sets ConvertedType for this field and returns itself.

Source

pub fn with_logical_type(self, logical_type: Option<LogicalType>) -> Self

Sets LogicalType for this field and returns itself. If only the logical type is populated for a primitive type, the converted type will be automatically populated, and can thus be omitted.

Source

pub fn with_length(self, length: i32) -> Self

Sets type length and returns itself. This is only applied to FIXED_LEN_BYTE_ARRAY and INT96 (INTERVAL) types, because they maintain fixed size underlying byte array. By default, value is 0.

Source

pub fn with_precision(self, precision: i32) -> Self

Sets precision for Parquet DECIMAL physical type and returns itself. By default, it equals to 0 and used only for decimal context.

Source

pub fn with_scale(self, scale: i32) -> Self

Sets scale for Parquet DECIMAL physical type and returns itself. By default, it equals to 0 and used only for decimal context.

Source

pub fn with_id(self, id: Option<i32>) -> Self

Sets optional field id and returns itself.

Source

pub fn build(self) -> Result<Type>

Creates a new PrimitiveType instance from the collected attributes. Returns Err in case of any building conditions are not met.

Source

fn check_decimal_precision_scale(&self) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T