#[non_exhaustive]pub enum LogicalType {
Show 33 variants
Null,
Boolean,
TinyInt,
SmallInt,
Integer,
BigInt,
HugeInt,
UTinyInt,
USmallInt,
UInteger,
UBigInt,
UHugeInt,
Float,
Double,
Decimal {
width: u8,
scale: u8,
},
Varchar,
Blob,
Bit,
Uuid,
Date,
Time,
TimeTz,
Timestamp,
TimestampS,
TimestampMs,
TimestampNs,
TimestampTz,
Interval,
List(Box<LogicalType>),
Array(Box<LogicalType>, u32),
Struct(Vec<Field>),
Map(Box<LogicalType>, Box<LogicalType>),
Union(Vec<Field>),
}Expand description
What SQL thinks a value is.
Nulls are not in here. spec/10-sql-and-types.md says null is a per-value property at every
nesting level, which makes it a property of a vector’s validity mask rather than of a type.
The one exception is LogicalType::Null, which is the type of a literal NULL before
anything has told it what it is, and which every other type absorbs during resolution.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Null
The type of an untyped NULL literal.
Boolean
BOOLEAN.
TinyInt
TINYINT, 8 bits signed.
SmallInt
SMALLINT, 16 bits signed.
Integer
INTEGER, 32 bits signed.
BigInt
BIGINT, 64 bits signed.
HugeInt
HUGEINT, 128 bits signed.
UTinyInt
UTINYINT, 8 bits unsigned.
USmallInt
USMALLINT, 16 bits unsigned.
UInteger
UINTEGER, 32 bits unsigned.
UBigInt
UBIGINT, 64 bits unsigned.
UHugeInt
UHUGEINT, 128 bits unsigned.
Float
FLOAT, IEEE 754 binary32.
Double
DOUBLE, IEEE 754 binary64.
Decimal
DECIMAL(width, scale), stored in the narrowest integer that holds width digits.
Fields
Varchar
VARCHAR. Length modifiers parse and are then ignored, as they are in DuckDB.
Blob
BLOB.
Bit
BIT, a bit string.
Uuid
UUID.
Date
DATE, days since 1970-01-01.
Time
TIME, microseconds since midnight.
TimeTz
TIME WITH TIME ZONE.
Timestamp
TIMESTAMP, microseconds since the epoch.
TimestampS
TIMESTAMP_S, seconds since the epoch.
TimestampMs
TIMESTAMP_MS, milliseconds since the epoch.
TimestampNs
TIMESTAMP_NS, nanoseconds since the epoch.
TimestampTz
TIMESTAMP WITH TIME ZONE.
Interval
INTERVAL, the months, days and microseconds triple.
List(Box<LogicalType>)
T[], a variable length list.
Array(Box<LogicalType>, u32)
T[n], a fixed length array.
Struct(Vec<Field>)
STRUCT(name type, ...).
Map(Box<LogicalType>, Box<LogicalType>)
MAP(key, value).
Union(Vec<Field>)
UNION(tag type, ...).
Implementations§
Source§impl LogicalType
impl LogicalType
Sourcepub fn decimal(width: u8, scale: u8) -> Result<Self>
pub fn decimal(width: u8, scale: u8) -> Result<Self>
A DECIMAL(width, scale), checked.
§Errors
If the width is zero or above 38, or the scale is greater than the width. Those are the same bounds DuckDB enforces and the message is the same message.
Sourcepub fn physical(&self) -> PhysicalType
pub fn physical(&self) -> PhysicalType
How this type is laid out.
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Whether arithmetic applies.
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Whether this is one of the integer types, signed or unsigned.
Sourcepub fn is_temporal(&self) -> bool
pub fn is_temporal(&self) -> bool
Whether this is a date, a time, a timestamp or an interval.
Sourcepub fn is_nested(&self) -> bool
pub fn is_nested(&self) -> bool
Whether this type contains other types.
Nested types are stored columnar all the way down, so this is the question of whether a column of this type is one column chunk or several.
Trait Implementations§
Source§impl Clone for LogicalType
impl Clone for LogicalType
Source§fn clone(&self) -> LogicalType
fn clone(&self) -> LogicalType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more