pub enum LogicalType {
Show 25 variants
Null,
Nothing,
Bool,
Int {
signed: bool,
bits: IntBits,
precision: Option<u16>,
},
Decimal {
precision: u16,
scale: u16,
},
Float {
bits: FloatBits,
precision: Option<u16>,
},
Str {
min: Option<u32>,
max: Option<u32>,
fixed: bool,
},
Bytes {
min: Option<u32>,
max: Option<u32>,
fixed: bool,
},
Date,
LocalTime,
LocalDatetime,
ZonedTime,
ZonedDatetime,
Duration(DurationKind),
Node(Option<String>),
Edge(Option<String>),
Graph(Option<String>),
BindingTable(Option<RecordType>),
Path(Option<Box<PathType>>),
List {
elem: Box<LogicalType>,
max: Option<u32>,
},
Record(RecordType),
Any,
Union(Vec<LogicalType>),
AnyProperty,
Nullable(Box<LogicalType>),
}Expand description
What GQL talks about: the language facing type lattice.
Never present in a vector. A vector holds a PhysicalType and a
validity bitmap, and the logical type is what the binder knows about
the column, which is a different and larger thing: INT(4) NOT NULL
and BIGINT are two logical types over one physical layout.
Variants§
Null
GV71. The type of the null literal, which every nullable type accepts and which carries no other value.
Nothing
GV72. The empty type: no value has it. A column can never be declared with it, an expression can have it, and the binder refuses anything that would have to materialise one.
Bool
Int
GV01 to GV19. signed and the width are the tower; precision
is the declared decimal digit count of INT(p), kept because it
is a check the engine owes the user and not a layout.
Decimal
GV17. Exact decimal, stored in the narrowest integer width that
holds precision digits and scaled by scale.
Float
GV20 to GV26.
Str
GV30 to GV32. Lengths are in characters, and a character is a
Unicode scalar value. fixed is GV32, the one length constraint
that changes the layout rather than adding a check.
Bytes
GV35 to GV38. Lengths are in octets.
Date
GV39. Proleptic Gregorian, no zone.
LocalTime
GV39. Time of day with no zone and therefore no DST.
LocalDatetime
GV39. An instant with no zone.
ZonedTime
GV40. Time of day with an offset from UTC in minutes.
ZonedDatetime
GV40. An instant with an offset from UTC in minutes.
Duration(DurationKind)
GV41.
Node(Option<String>)
A node reference, optionally of a named node type.
Edge(Option<String>)
An edge reference, optionally of a named edge type.
Graph(Option<String>)
GV60. A graph handle: a catalog id and a snapshot epoch, not
data. Making it a value is what turns USE from a statement
prefix into something composable.
BindingTable(Option<RecordType>)
GV61. A binding table handle, with the record type of its rows when that is known.
Path(Option<Box<PathType>>)
GV55. A path, whose type describes the alternating node and edge types it walks.
List
GV50.
Record(RecordType)
GV45 to GV48.
Any
GV65 and GV66. The open dynamic union: any type at all.
Union(Vec<LogicalType>)
GV67. A closed dynamic union, ANY<INT|STRING>.
AnyProperty
GV68. Any type a property may hold, which is Any minus the
reference and constructed types.
Nullable(Box<LogicalType>)
GV90, orthogonal to everything above. Nullability is a wrapper and not a flag on each variant, so no variant can forget it.
Implementations§
Source§impl LogicalType
impl LogicalType
Sourcepub fn nullable(self) -> LogicalType
pub fn nullable(self) -> LogicalType
A nullable version of this type, without stacking wrappers.
Sourcepub fn is_nullable(&self) -> bool
pub fn is_nullable(&self) -> bool
Whether a value of this type may be null. NULL itself is
nullable and nothing else is unless it says so, which is the
GV90 reading: a declared type is not null until wrapped.
Sourcepub fn base(&self) -> &LogicalType
pub fn base(&self) -> &LogicalType
This type with any nullability wrapper removed, which is the form every layout question is asked about.
Sourcepub fn is_material(&self) -> bool
pub fn is_material(&self) -> bool
Whether this type may hold a value at all. The immaterial types
(GV71, GV72) cannot: NOTHING has no values and NULL has one
that is never stored in a vector.
Sourcepub fn physical(&self) -> Option<PhysicalType>
pub fn physical(&self) -> Option<PhysicalType>
The layout a vector of this type uses, or None when there is
nothing to lay out.
The dynamic unions map to Struct, which holds a type code
child and one child per member. That is the one construct in the
system that puts a tag back next to each value, and it is
confined to columns declared as unions, which in practice is the
schemaless ingest path and nothing else.
Sourcepub fn int(bits: IntBits) -> LogicalType
pub fn int(bits: IntBits) -> LogicalType
The common integer spellings, so a caller does not write the
struct out to say BIGINT.
pub fn uint(bits: IntBits) -> LogicalType
pub fn float(bits: FloatBits) -> LogicalType
Sourcepub fn string() -> LogicalType
pub fn string() -> LogicalType
A string with no length constraint.
Sourcepub fn bytes() -> LogicalType
pub fn bytes() -> LogicalType
A byte string with no length constraint.