pub enum Op {
Show 108 variants
LoadColumn(u16),
LoadColumn2(u16),
LoadOuterColumn(CompactArc<str>),
LoadConst(Value),
LoadParam(u16),
LoadNamedParam(CompactArc<str>),
LoadNull(DataType),
Eq,
Ne,
Lt,
Le,
Gt,
Ge,
IsNull,
IsNotNull,
IsDistinctFrom,
IsNotDistinctFrom,
EqColumnConst(u16, Value),
NeColumnConst(u16, Value),
LtColumnConst(u16, Value),
LeColumnConst(u16, Value),
GtColumnConst(u16, Value),
GeColumnConst(u16, Value),
IsNullColumn(u16),
IsNotNullColumn(u16),
LikeColumn(u16, Arc<CompiledPattern>, bool),
InSetColumn(u16, CompactArc<ValueSet>, bool),
BetweenColumnConst(u16, Value, Value),
And(u16),
Or(u16),
Not,
Xor,
AndFinalize,
OrFinalize,
Add,
Sub,
Mul,
Div,
Mod,
Neg,
BitAnd,
BitOr,
BitXor,
BitNot,
Shl,
Shr,
Concat,
ConcatN(u8),
Like(Arc<CompiledPattern>, bool),
Glob(Arc<CompiledPattern>),
Regexp(Arc<Regex>),
LikeEscape(Arc<CompiledPattern>, bool, char),
LikeDynamic(bool),
LikeDynamicEscape(bool, char),
GlobDynamic,
RegexpDynamic,
JsonAccess,
JsonAccessText,
TimestampAddInterval,
TimestampSubInterval,
TimestampDiff,
TimestampAddDays,
TimestampSubDays,
VectorDistanceL2,
VectorDistanceCosine,
VectorDistanceIP,
InSet(CompactArc<ValueSet>, bool),
NotInSet(CompactArc<ValueSet>, bool),
Between,
NotBetween,
InTupleSet {
tuple_size: u8,
values: Arc<Vec<Vec<Value>>>,
negated: bool,
},
IsTrue,
IsNotTrue,
IsFalse,
IsNotFalse,
CallScalar {
func: Arc<dyn ScalarFunction>,
arg_count: u8,
},
CallStored {
name: CompactArc<str>,
arg_count: u8,
},
Coalesce(u8),
NullIf,
Greatest(u8),
Least(u8),
NativeFn1(NativeFn1),
Cast(DataType),
CastExternal(CompactArc<str>),
TruncateToDate,
CaseStart,
CaseWhen(u16),
CaseThen(u16),
CaseElse,
CaseEnd,
CaseCompare,
Jump(u16),
JumpIfTrue(u16),
JumpIfFalse(u16),
JumpIfNull(u16),
JumpIfNotNull(u16),
PopJumpIfTrue(u16),
PopJumpIfFalse(u16),
Dup,
Pop,
Swap,
LoadAggregateResult(u16),
LoadTransactionId,
Nop,
Return,
ReturnTrue,
ReturnFalse,
ReturnNull(DataType),
}Expand description
Expression VM Operation
Each operation is self-contained with all data needed for execution. No external lookups during execution - everything resolved at compile time.
Variants§
LoadColumn(u16)
Load column value by pre-resolved index
Stack: [] -> [value]
LoadColumn2(u16)
Load column from second row (for joins)
Stack: [] -> [value]
LoadOuterColumn(CompactArc<str>)
Load from outer row context (for correlated subqueries)
Uses pre-resolved key
Stack: [] -> [value]
LoadConst(Value)
Load constant value (pre-cloned at compile time)
Stack: [] -> [value]
LoadParam(u16)
Load query parameter by index
Stack: [] -> [value]
LoadNamedParam(CompactArc<str>)
Load named parameter
Stack: [] -> [value]
LoadNull(DataType)
Load NULL with type hint
Stack: [] -> [null]
Eq
Equal: a == b
Ne
Not equal: a != b
Lt
Less than: a < b
Le
Less than or equal: a <= b
Gt
Greater than: a > b
Ge
Greater than or equal: a >= b
IsNull
IS NULL check
Stack: [value] -> [bool]
IsNotNull
IS NOT NULL check
Stack: [value] -> [bool]
IsDistinctFrom
IS DISTINCT FROM (NULL-safe not equal)
Stack: [a, b] -> [bool]
IsNotDistinctFrom
IS NOT DISTINCT FROM (NULL-safe equal)
Stack: [a, b] -> [bool]
EqColumnConst(u16, Value)
Fused: column == constant
Stack: [] -> [bool]
NeColumnConst(u16, Value)
Fused: column != constant
Stack: [] -> [bool]
LtColumnConst(u16, Value)
Fused: column < constant
Stack: [] -> [bool]
LeColumnConst(u16, Value)
Fused: column <= constant
Stack: [] -> [bool]
GtColumnConst(u16, Value)
Fused: column > constant
Stack: [] -> [bool]
GeColumnConst(u16, Value)
Fused: column >= constant
Stack: [] -> [bool]
IsNullColumn(u16)
Fused: column IS NULL
Stack: [] -> [bool]
IsNotNullColumn(u16)
Fused: column IS NOT NULL
Stack: [] -> [bool]
LikeColumn(u16, Arc<CompiledPattern>, bool)
Fused: column LIKE pattern
Stack: [] -> [bool]
InSetColumn(u16, CompactArc<ValueSet>, bool)
Fused: column IN (constant set with AHash)
Stack: [] -> [bool]
BetweenColumnConst(u16, Value, Value)
Fused: column BETWEEN low AND high (constants)
Stack: [] -> [bool]
And(u16)
Logical AND with short-circuit
If top of stack is false, jump to target
Stack: [bool] -> [bool] (or jump)
Or(u16)
Logical OR with short-circuit
If top of stack is true, jump to target
Stack: [bool] -> [bool] (or jump)
Not
Logical NOT
Stack: [bool] -> [bool]
Xor
Logical XOR
Stack: [a, b] -> [bool]
AndFinalize
AND finalize - combine left and right results
Stack: [left_bool, right_bool] -> [bool]
OrFinalize
OR finalize - combine left and right results
Stack: [left_bool, right_bool] -> [bool]
Add
Sub
Mul
Div
Mod
Neg
Unary negation
Stack: [value] -> [-value]
BitAnd
BitOr
BitXor
BitNot
Shl
Shr
Concat
String concatenation (binary)
Stack: [a, b] -> [a || b]
ConcatN(u8)
Multi-value string concatenation (optimized for chained ||)
Stack: [v1, v2, ..., vN] -> [v1 || v2 || ... || vN]
Pre-calculates total length and allocates once
Like(Arc<CompiledPattern>, bool)
LIKE pattern match (pre-compiled pattern)
Stack: [text] -> [bool]
Glob(Arc<CompiledPattern>)
GLOB pattern match
Stack: [text] -> [bool]
Regexp(Arc<Regex>)
REGEXP match (pre-compiled regex)
Stack: [text] -> [bool]
LikeEscape(Arc<CompiledPattern>, bool, char)
LIKE with ESCAPE character
Stack: [text] -> [bool]
LikeDynamic(bool)
Dynamic LIKE: pattern is on the stack (e.g. from a parameter)
Stack: [text, pattern_text] -> [bool]
LikeDynamicEscape(bool, char)
Dynamic LIKE with ESCAPE: pattern is on the stack, escape char is compiled in
Stack: [text, pattern_text] -> [bool]
GlobDynamic
Dynamic GLOB: pattern is on the stack
Stack: [text, pattern_text] -> [bool]
RegexpDynamic
Dynamic REGEXP: pattern is on the stack
Stack: [text, pattern_text] -> [bool]
JsonAccess
JSON access: json -> key (returns JSON)
Stack: [json, key] -> [json_value]
JsonAccessText
JSON access text: json ->> key (returns TEXT)
Stack: [json, key] -> [text_value]
TimestampAddInterval
Add interval to timestamp: timestamp + interval_string
Stack: [timestamp, interval_text] -> [timestamp]
TimestampSubInterval
Subtract interval from timestamp: timestamp - interval_string
Stack: [timestamp, interval_text] -> [timestamp]
TimestampDiff
Subtract timestamps: timestamp - timestamp (returns interval text)
Stack: [timestamp1, timestamp2] -> [interval_text]
TimestampAddDays
Add days to timestamp: timestamp + integer
Stack: [timestamp, days] -> [timestamp]
TimestampSubDays
Subtract days from timestamp: timestamp - integer
Stack: [timestamp, days] -> [timestamp]
VectorDistanceL2
L2 (Euclidean) distance between two vectors
Stack: [vector1, vector2] -> [float]
VectorDistanceCosine
Cosine distance between two vectors (1 - cosine_similarity)
Stack: [vector1, vector2] -> [float]
VectorDistanceIP
Negative inner product distance between two vectors
Stack: [vector1, vector2] -> [float]
InSet(CompactArc<ValueSet>, bool)
IN set membership (pre-built FxHashSet for fast lookups)
Stack: [value] -> [bool]
NotInSet(CompactArc<ValueSet>, bool)
NOT IN set membership
Stack: [value] -> [bool]
Between
BETWEEN check: value BETWEEN low AND high
Stack: [value, low, high] -> [bool]
NotBetween
NOT BETWEEN check
Stack: [value, low, high] -> [bool]
InTupleSet
Multi-column IN: (a, b) IN ((1, 2), (3, 4))
Stack: [val1, val2, ...valN] -> [bool]
The tuple_values contains pre-evaluated constant tuples
IsTrue
IS TRUE check
Stack: [value] -> [bool]
IsNotTrue
IS NOT TRUE check
Stack: [value] -> [bool]
IsFalse
IS FALSE check
Stack: [value] -> [bool]
IsNotFalse
IS NOT FALSE check
Stack: [value] -> [bool]
CallScalar
Call scalar function with N arguments
Stack: [arg1, arg2, ..., argN] -> [result]
CallStored
Call a durable catalog Function through the request-local executor bridge. Resolution is repeated against the pinned catalog generation.
Coalesce(u8)
Special: COALESCE - return first non-null
Stack: [arg1, ..., argN] -> [result]
NullIf
Special: NULLIF(a, b) - return NULL if a = b
Stack: [a, b] -> [a or null]
Greatest(u8)
Special: GREATEST - return max of args
Stack: [arg1, ..., argN] -> [result]
Least(u8)
Special: LEAST - return min of args
Stack: [arg1, ..., argN] -> [result]
NativeFn1(NativeFn1)
Native scalar function - single argument, direct function pointer call
Stack: [value] -> [result]
Cast(DataType)
Cast value to target type
Stack: [value] -> [casted_value]
CastExternal(CompactArc<str>)
Cast TEXT/BYTES into a schema-qualified external type. Resolution and
codec invocation stay request-local and catalog-bound.
Stack: [value] -> [external_value]
TruncateToDate
Truncate timestamp to date (midnight)
Used for CAST(timestamp AS DATE) - truncates time component to 00:00:00
Stack: [value] -> [timestamp_at_midnight]
CaseStart
Start of CASE - marks beginning
CaseWhen(u16)
WHEN condition: if top is false, jump to next branch
Stack: [bool] -> [] (condition consumed)
CaseThen(u16)
THEN result: jump to CASE end after pushing result
Stack: [value] -> [value] (then jump)
CaseElse
ELSE clause marker
CaseEnd
End of CASE
CaseCompare
Simple CASE: compare value with WHEN value
Stack: [case_value, when_value] -> [bool]
Jump(u16)
Unconditional jump
JumpIfTrue(u16)
Jump if top of stack is true (doesn’t pop)
JumpIfFalse(u16)
Jump if top of stack is false (doesn’t pop)
JumpIfNull(u16)
Jump if top of stack is NULL (doesn’t pop)
JumpIfNotNull(u16)
Jump if top of stack is NOT NULL (doesn’t pop) Used for COALESCE short-circuit evaluation
PopJumpIfTrue(u16)
Pop and jump if true
PopJumpIfFalse(u16)
Pop and jump if false
Dup
Duplicate top of stack
Pop
Pop top of stack (discard)
Swap
Swap top two stack elements
LoadAggregateResult(u16)
Load pre-computed aggregate result by column index
Used in HAVING clauses where aggregates are already computed
Stack: [] -> [value]
LoadTransactionId
Load current transaction ID
Returns NULL if no transaction is active
Stack: [] -> [value]
Nop
No operation (placeholder)
Return
Return current top of stack as result
ReturnTrue
Return true immediately
ReturnFalse
Return false immediately
ReturnNull(DataType)
Return NULL immediately