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>
impl<'a> PrimitiveTypeBuilder<'a>
Sourcepub fn new(name: &'a str, physical_type: PhysicalType) -> Self
pub fn new(name: &'a str, physical_type: PhysicalType) -> Self
Creates new primitive type builder with provided field name and physical type.
Sourcepub fn with_repetition(self, repetition: Repetition) -> Self
pub fn with_repetition(self, repetition: Repetition) -> Self
Sets Repetition
for this field and returns itself.
Sourcepub fn with_converted_type(self, converted_type: ConvertedType) -> Self
pub fn with_converted_type(self, converted_type: ConvertedType) -> Self
Sets ConvertedType
for this field and returns itself.
Sourcepub fn with_logical_type(self, logical_type: Option<LogicalType>) -> Self
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.
Sourcepub fn with_length(self, length: i32) -> Self
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
.
Sourcepub fn with_precision(self, precision: i32) -> Self
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.
Sourcepub fn with_scale(self, scale: i32) -> Self
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.
Sourcepub fn build(self) -> Result<Type>
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.
fn check_decimal_precision_scale(&self) -> Result<()>
Auto Trait Implementations§
impl<'a> Freeze for PrimitiveTypeBuilder<'a>
impl<'a> RefUnwindSafe for PrimitiveTypeBuilder<'a>
impl<'a> Send for PrimitiveTypeBuilder<'a>
impl<'a> Sync for PrimitiveTypeBuilder<'a>
impl<'a> Unpin for PrimitiveTypeBuilder<'a>
impl<'a> UnwindSafe for PrimitiveTypeBuilder<'a>
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> 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