pub enum ExprOp {
Show 18 variants
LoadCol {
col: u8,
dst: Reg,
},
LoadConst {
v: OwnedValue,
dst: Reg,
},
Binary {
op: BinOp,
l: Reg,
r: Reg,
dst: Reg,
},
Math {
op: MathOp,
src: Reg,
dst: Reg,
},
MathPair {
op: MathPair,
l: Reg,
r: Reg,
dst: Reg,
},
StrLen {
op: StrLen,
src: Reg,
dst: Reg,
},
StrFold {
op: StrFold,
src: Reg,
dst: Reg,
},
StrTrim {
ends: StrTrim,
set: Arc<TrimSet>,
src: Reg,
dst: Reg,
},
StrCut {
end: StrCut,
src: Reg,
n: Reg,
dst: Reg,
},
StrNorm {
form: NormalForm,
src: Reg,
dst: Reg,
},
StrNormalized {
form: NormalForm,
negated: bool,
src: Reg,
dst: Reg,
},
ElementId {
table: u32,
src: Reg,
dst: Reg,
},
Between {
of: LogicalType,
kind: DurationKind,
from: Reg,
to: Reg,
dst: Reg,
},
Compare {
op: CmpOp,
l: Reg,
r: Reg,
dst: Reg,
},
IsNull {
src: Reg,
negated: bool,
dst: Reg,
},
All {
on: bool,
dst: Reg,
},
And {
l: Reg,
r: Reg,
dst: Reg,
},
Or {
l: Reg,
r: Reg,
dst: Reg,
},
}Variants§
LoadCol
Read a chunk column into a register. A borrow at evaluation, not a copy; the register remembers the column index.
LoadConst
Binary
Math
One of the numeric functions over a single number, whose answer is a value like any other. The op carries which function it is, so a call costs no dispatch per row.
MathPair
One of the numeric functions over two numbers: POWER, LOG and MOD under its function spelling. Two registers in and one out, and both arguments hold the one type by the time they get here.
StrLen
The length of a string, in characters or in bytes. The answer is a number, so this is the one string function whose output needs no room in the arena for bytes.
StrFold
A fold of a string, up or down. The answer is a string, so this is the first op whose output carries bytes of its own rather than only numbers.
StrTrim
A trim of a string, off either end or both. The set of characters is whatever the statement wrote, prepared once at compile time and shared by every chunk the program runs over, since it is the same set for all of them.
StrCut
The characters at one end of a string, counted by a second register rather than by something the statement wrote, since LEFT and RIGHT take their count as an ordinary argument and a column is one of the things that can arrive in it.
StrNorm
A string put into one of the four normal forms. The form is whatever the statement wrote, or NFC where it wrote none, and it is the same form for every chunk the program runs over.
StrNormalized
Whether a string is in a normal form already. This is the one
string op whose answer is a predicate rather than a value, so it
writes a bitmap the way a comparison does. negated carries the
NOT, which belongs in the kernel: a null row is off in either
answer, and a complement of the bitmap would have turned it on.
ElementId
The identifier of a node, which is the one element function whose answer is a string. The table comes from the plan, a level having one for every row it will ever produce, and the register holds the rows themselves.
Between
The length of time from one instant to another. The op carries the type both operands hold and the kind of duration asked for, which is everything the kernel needs to pick its loop, so the choice is made once a chunk and no value in the loop carries a tag.
Compare
Comparison produces a predicate bitmap register.
IsNull
A null test reads the operand’s validity, which is the answer
already: IS NULL is the complement of the validity bitmap, IS
NOT NULL is the bitmap itself. negated carries the NOT.
All
A predicate the rows cannot change: every row passes, or none
does. IS TYPED against the type a column already has is the
case that puts one here, since the answer is a fact about the
column and the compiler knows it before a row is read. Writing
it as an op rather than dropping the filter keeps the program
able to say false, which a dropped filter cannot.