pub enum DType {
Null,
Bool(Nullability),
Primitive(PType, Nullability),
Decimal(DecimalDType, Nullability),
Utf8(Nullability),
Binary(Nullability),
List(Arc<DType>, Nullability),
Struct(StructFields, Nullability),
Extension(Arc<ExtDType>),
}Expand description
The logical types of elements in Vortex arrays.
DType represents the different logical data types that can be represented in a Vortex array.
This is different from physical types, which represent the actual layout of data (compressed or uncompressed). The set of physical types/formats (or data layout) is surjective into the set of logical types (or in other words, all physical types map to a single logical type).
Note that a DType represents the logical type of the elements in the Arrays, not the
logical type of the Array itself.
For example, an array with DType::Primitive(I32, NonNullable) could be physically
encoded as any of the following:
- A flat array of
i32values. - A run-length encoded sequence.
- Dictionary encoded values with bitpacked codes.
All of these physical encodings preserve the same logical I32 type, even if the physical
data is different.
Variants§
Null
A logical null type.
Null only has a single value, null.
Bool(Nullability)
A logical boolean type.
Bool can be true or false if non-nullable. It can be true, false, or null if
nullable.
Primitive(PType, Nullability)
A logical fixed-width numeric type.
This can be unsigned, signed, or floating point. See PType for more information.
Decimal(DecimalDType, Nullability)
Logical real numbers with fixed precision and scale.
See DecimalDType for more information.
Utf8(Nullability)
Logical UTF-8 strings.
Binary(Nullability)
Logical binary data.
List(Arc<DType>, Nullability)
A logical variable-length list type.
This is parameterized by a single DType that represents the element type of the inner
lists.
Struct(StructFields, Nullability)
A logical struct type.
A Struct type is composed of an ordered list of fields, each with a corresponding name and
DType. See StructFields for more information.
Extension(Arc<ExtDType>)
A user-defined extension type.
See ExtDType for more information.
Implementations§
Source§impl DType
impl DType
Sourcepub fn to_arrow_schema(&self) -> VortexResult<Schema>
pub fn to_arrow_schema(&self) -> VortexResult<Schema>
Sourcepub fn to_arrow_dtype(&self) -> VortexResult<DataType>
pub fn to_arrow_dtype(&self) -> VortexResult<DataType>
Source§impl DType
impl DType
Sourcepub fn nullability(&self) -> Nullability
pub fn nullability(&self) -> Nullability
Get the nullability of the DType.
Sourcepub fn is_nullable(&self) -> bool
pub fn is_nullable(&self) -> bool
Check if the DType is Nullability::Nullable.
Sourcepub fn as_nonnullable(&self) -> Self
pub fn as_nonnullable(&self) -> Self
Get a new DType with Nullability::NonNullable (but otherwise the same as self)
Sourcepub fn as_nullable(&self) -> Self
pub fn as_nullable(&self) -> Self
Get a new DType with Nullability::Nullable (but otherwise the same as self)
Sourcepub fn with_nullability(&self, nullability: Nullability) -> Self
pub fn with_nullability(&self, nullability: Nullability) -> Self
Get a new DType with the given nullability (but otherwise the same as self)
Sourcepub fn union_nullability(&self, other: Nullability) -> Self
pub fn union_nullability(&self, other: Nullability) -> Self
Union the nullability of this DType with the other nullability, returning a new DType.
Sourcepub fn eq_ignore_nullability(&self, other: &Self) -> bool
pub fn eq_ignore_nullability(&self, other: &Self) -> bool
Check if self and other are equal, ignoring nullability.
Sourcepub fn is_primitive(&self) -> bool
pub fn is_primitive(&self) -> bool
Check if self is a primitive type
Sourcepub fn is_unsigned_int(&self) -> bool
pub fn is_unsigned_int(&self) -> bool
Check if self is an unsigned integer
Sourcepub fn is_signed_int(&self) -> bool
pub fn is_signed_int(&self) -> bool
Check if self is a signed integer
Sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Check if self is a boolean
Sourcepub fn is_extension(&self) -> bool
pub fn is_extension(&self) -> bool
Check if self is an extension type
Sourcepub fn is_decimal(&self) -> bool
pub fn is_decimal(&self) -> bool
Check if self is a decimal type
Sourcepub fn as_decimal_opt(&self) -> Option<&DecimalDType>
pub fn as_decimal_opt(&self) -> Option<&DecimalDType>
Check returns the inner decimal type if the dtype is a decimal
Sourcepub fn as_struct_opt(&self) -> Option<&StructFields>
pub fn as_struct_opt(&self) -> Option<&StructFields>
Get the StructDType if self is a StructDType, otherwise None
Sourcepub fn as_list_element_opt(&self) -> Option<&Arc<DType>>
pub fn as_list_element_opt(&self) -> Option<&Arc<DType>>
Get the inner dtype if self is a ListDType, otherwise None
Sourcepub fn struct_<I: IntoIterator<Item = (impl Into<FieldName>, impl Into<FieldDType>)>>(
iter: I,
nullability: Nullability,
) -> Self
pub fn struct_<I: IntoIterator<Item = (impl Into<FieldName>, impl Into<FieldDType>)>>( iter: I, nullability: Nullability, ) -> Self
Convenience method for creating a DType::Struct.
Sourcepub fn list(dtype: impl Into<DType>, nullability: Nullability) -> Self
pub fn list(dtype: impl Into<DType>, nullability: Nullability) -> Self
Convenience method for creating a list dtype
Source§impl DType
impl DType
Sourcepub fn try_from_view(fb: DType<'_>, buffer: FlatBuffer) -> VortexResult<Self>
pub fn try_from_view(fb: DType<'_>, buffer: FlatBuffer) -> VortexResult<Self>
Create a new
Trait Implementations§
Source§impl From<DType> for FieldDType
impl From<DType> for FieldDType
Source§impl FromArrowType<&Field> for DType
impl FromArrowType<&Field> for DType
Source§fn from_arrow(field: &Field) -> Self
fn from_arrow(field: &Field) -> Self
Source§impl FromArrowType<&Schema> for DType
impl FromArrowType<&Schema> for DType
Source§fn from_arrow(value: &Schema) -> Self
fn from_arrow(value: &Schema) -> Self
Source§impl FromArrowType<(&DataType, Nullability)> for DType
impl FromArrowType<(&DataType, Nullability)> for DType
Source§fn from_arrow((data_type, nullability): (&DataType, Nullability)) -> Self
fn from_arrow((data_type, nullability): (&DataType, Nullability)) -> Self
Source§impl FromArrowType<Arc<Schema>> for DType
impl FromArrowType<Arc<Schema>> for DType
Source§fn from_arrow(value: SchemaRef) -> Self
fn from_arrow(value: SchemaRef) -> Self
Source§impl TryFrom<&DType> for DecimalDType
impl TryFrom<&DType> for DecimalDType
Source§impl TryFrom<&DType> for PType
impl TryFrom<&DType> for PType
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(value: &DType) -> VortexResult<Self>
fn try_from(value: &DType) -> VortexResult<Self>
Source§impl TryFrom<DType> for DecimalDType
impl TryFrom<DType> for DecimalDType
Source§impl WriteFlatBuffer for DType
impl WriteFlatBuffer for DType
Source§fn write_flatbuffer<'fb>(
&self,
fbb: &mut FlatBufferBuilder<'fb>,
) -> WIPOffset<Self::Target<'fb>>
fn write_flatbuffer<'fb>( &self, fbb: &mut FlatBufferBuilder<'fb>, ) -> WIPOffset<Self::Target<'fb>>
impl Eq for DType
impl FlatBufferRoot for DType
impl StructuralPartialEq for DType
Auto Trait Implementations§
impl Freeze for DType
impl RefUnwindSafe for DType
impl Send for DType
impl Sync for DType
impl Unpin for DType
impl UnwindSafe for DType
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 moreSource§impl<F> WriteFlatBufferExt for Fwhere
F: WriteFlatBuffer + FlatBufferRoot,
impl<F> WriteFlatBufferExt for Fwhere
F: WriteFlatBuffer + FlatBufferRoot,
Source§fn write_flatbuffer_bytes(&self) -> ConstBuffer<u8, 8>
fn write_flatbuffer_bytes(&self) -> ConstBuffer<u8, 8>
FlatBuffer byte buffer.