#[non_exhaustive]pub enum PhysicalType {
Show 19 variants
Bool,
Int8,
Int16,
Int32,
Int64,
Int128,
UInt8,
UInt16,
UInt32,
UInt64,
UInt128,
Float32,
Float64,
Interval,
Varlen,
List,
Array,
Struct,
Empty,
}Expand description
How a value is actually laid out in a vector.
The planner picks operators off this rather than off the logical type, which is why DATE and
INTEGER share an implementation of everything that does not care what the number means.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Bool
One byte per value, zero or one.
Int8
8 bit signed.
Int16
16 bit signed.
Int32
32 bit signed.
Int64
64 bit signed.
Int128
128 bit signed.
UInt8
8 bit unsigned.
UInt16
16 bit unsigned.
UInt32
32 bit unsigned.
UInt64
64 bit unsigned.
UInt128
128 bit unsigned.
Float32
IEEE 754 binary32.
Float64
IEEE 754 binary64.
Interval
The months, days and microseconds triple.
Varlen
The 16 byte string representation from spec/07-execution.md section 7.1.
List
Offsets plus one child column.
Array
A fixed stride into one child column.
Struct
Named child columns, one per field.
Empty
No storage. Only the validity mask says anything.
Implementations§
Source§impl PhysicalType
impl PhysicalType
Sourcepub const fn size(self) -> usize
pub const fn size(self) -> usize
How many bytes one value of this layout takes in a vector.
What the values buffer costs per row, and not what a row costs. A VARCHAR is 16 because that
is the view, and the bytes of a long string are somewhere else. A LIST is 8 because that is
the start and the length, and the elements are in the child. A STRUCT is 0 because the parent
holds nothing of its own beyond the validity mask, and every byte it costs is a child’s.
This is the number duckdb_types().type_size reports, so it is worth naming the three places
it disagrees with the pinned binary, all of which are this engine’s layout rather than a
transcription error. A list entry is two u32 here and two u64 there, so a LIST and a
MAP are 8 against 16. The null type stores nothing here and is given an INT32 body there,
so it is 0 against 4.
Trait Implementations§
Source§impl Clone for PhysicalType
impl Clone for PhysicalType
Source§fn clone(&self) -> PhysicalType
fn clone(&self) -> PhysicalType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more