#[cfg(feature = "arbitrary")]
mod arbitrary;
pub mod arrow;
mod bigint;
mod coercion;
mod decimal;
mod dtype_impl;
pub mod extension;
mod f16;
mod field;
mod field_mask;
mod field_names;
mod native_dtype;
mod nullability;
mod ptype;
pub mod serde;
pub mod session;
mod struct_;
use std::sync::Arc;
#[derive(Debug, Clone, Eq, Hash)]
#[allow(clippy::derived_hash_with_manual_eq)] pub enum DType {
Null,
Bool(Nullability),
Primitive(PType, Nullability),
Decimal(DecimalDType, Nullability),
Utf8(Nullability),
Binary(Nullability),
List(Arc<DType>, Nullability),
FixedSizeList(Arc<DType>, u32, Nullability),
Struct(StructFields, Nullability),
Extension(ExtDTypeRef),
Variant(Nullability),
}
impl PartialEq for DType {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Null, Self::Null) => true,
(Self::Bool(a), Self::Bool(b)) => a == b,
(Self::Primitive(pa, na), Self::Primitive(pb, nb)) => pa == pb && na == nb,
(Self::Decimal(da, na), Self::Decimal(db, nb)) => da == db && na == nb,
(Self::Utf8(a), Self::Utf8(b)) => a == b,
(Self::Binary(a), Self::Binary(b)) => a == b,
(Self::List(da, na), Self::List(db, nb)) => {
na == nb && (Arc::ptr_eq(da, db) || da == db)
}
(Self::FixedSizeList(da, sa, na), Self::FixedSizeList(db, sb, nb)) => {
sa == sb && na == nb && (Arc::ptr_eq(da, db) || da == db)
}
(Self::Struct(a, na), Self::Struct(b, nb)) => na == nb && a == b,
(Self::Extension(a), Self::Extension(b)) => a == b,
(Self::Variant(a), Self::Variant(b)) => a == b,
(Self::Null, _)
| (Self::Bool(_), _)
| (Self::Primitive(..), _)
| (Self::Decimal(..), _)
| (Self::Utf8(_), _)
| (Self::Binary(_), _)
| (Self::List(..), _)
| (Self::FixedSizeList(..), _)
| (Self::Struct(..), _)
| (Self::Extension(_), _)
| (Self::Variant(_), _) => false,
}
}
}
pub use bigint::*;
pub use decimal::*;
pub use dtype_impl::NativeDType;
pub use f16::*;
pub use field::*;
pub use field_mask::*;
pub use field_names::*;
pub use half;
pub use nullability::*;
pub use ptype::*;
pub use struct_::*;
use crate::dtype::extension::ExtDTypeRef;
pub mod proto {
pub use vortex_proto::dtype;
}
pub mod flatbuffers {
pub use vortex_flatbuffers::dtype::*;
}
#[cfg(test)]
mod test {
use std::sync::LazyLock;
use vortex_session::VortexSession;
use crate::dtype::session::DTypeSession;
pub(crate) static SESSION: LazyLock<VortexSession> =
LazyLock::new(|| VortexSession::empty().with::<DTypeSession>());
}