Enum otter_sql::ic::Instruction
source ยท pub enum Instruction {
Show 28 variants
Value {
index: RegisterIndex,
value: Value,
},
Expr {
index: RegisterIndex,
expr: Expr,
},
Source {
index: RegisterIndex,
name: TableRef,
},
Empty {
index: RegisterIndex,
},
NonExistent {
index: RegisterIndex,
},
Filter {
index: RegisterIndex,
expr: Expr,
},
Project {
input: RegisterIndex,
output: RegisterIndex,
expr: Expr,
alias: Option<BoundedString>,
},
GroupBy {
index: RegisterIndex,
expr: Expr,
},
Order {
index: RegisterIndex,
expr: Expr,
ascending: bool,
},
Limit {
index: RegisterIndex,
limit: u64,
},
Return {
index: RegisterIndex,
},
NewSchema {
schema_name: SchemaRef,
exists_ok: bool,
},
ColumnDef {
index: RegisterIndex,
name: BoundedString,
data_type: DataType,
},
AddColumnOption {
index: RegisterIndex,
option: ColumnOptionDef,
},
AddColumn {
table_reg_index: RegisterIndex,
col_index: RegisterIndex,
},
NewTable {
index: RegisterIndex,
name: TableRef,
exists_ok: bool,
},
DropTable {
index: RegisterIndex,
},
RemoveColumn {
index: RegisterIndex,
col_name: BoundedString,
},
RenameColumn {
index: RegisterIndex,
old_name: BoundedString,
new_name: BoundedString,
},
InsertDef {
table_reg_index: RegisterIndex,
index: RegisterIndex,
},
ColumnInsertDef {
insert_index: RegisterIndex,
col_name: BoundedString,
},
RowDef {
insert_index: RegisterIndex,
row_index: RegisterIndex,
},
AddValue {
row_index: RegisterIndex,
expr: Expr,
},
Insert {
index: RegisterIndex,
},
Update {
index: RegisterIndex,
col: Expr,
expr: Expr,
},
Union {
input1: RegisterIndex,
input2: RegisterIndex,
output: RegisterIndex,
},
CrossJoin {
input1: RegisterIndex,
input2: RegisterIndex,
output: RegisterIndex,
},
NaturalJoin {
input1: RegisterIndex,
input2: RegisterIndex,
output: RegisterIndex,
},
}Expand description
The instruction set of OtterSQL.
Variantsยง
Value
Load a Value into a register.
Expr
Load a Expr into a register.
Source
Load an existing table given by name.
This will result in a Register::TableRef being stored at the
given register.
Empty
Fields
index: RegisterIndexCreate a new empty Register::TableRef.
NonExistent
Fields
index: RegisterIndexCreate a new [Register::TableRef](crate::vm::Register::TableRef) pointing to a
non-existent table.
Filter
Filter the Register::TableRef at index using the given expression.
This represents a WHERE clause of a SELECT statement in SQL.
Project
Create a projection of the columns of the Register::TableRef at input.
The resultant column is added to the Register::TableRef
at output. It must be either an empty table or a table with the same number of rows.
This represents the column list of the SELECT statement in SQL.
GroupBy
Group the Register::TableRef at index by the given expression.
This will result in a Register::GroupedTable being stored at the index register.
Must be added before any projections so as to catch errors in column selections.
Order
Order the Register::TableRef at index by the given expression.
This represents the ORDER BY clause in SQL.
Limit
Truncate the Register::TableRef at index to the given number of rows.
This represents the LIMIT clause in SQL.
Return
Fields
index: RegisterIndexReturn from register at index.
Some values stored in a register may be intermediate values and cannot be returned.
See Register for more information.
NewSchema
Fields
Create a new schema.
This represents a CREATE SCHEMA [IF NOT EXISTS] statement.
ColumnDef
Start defining a new column and store the temporary metadata in register index.
The value stored in the register will be of type Register::Column.
AddColumnOption
Add an option or constraint to the Column definition in register index.
AddColumn
Add column in register col_index to the Register::TableRef in table_reg_index.
NewTable
Fields
index: RegisterIndexCreate table from the Register::TableRef in register index.
Creation implies that the table is added to the schema.
This represents a CREATE TABLE [IF NOT EXISTS] statement.
DropTable
Fields
index: RegisterIndexDrop the table referenced by the Register::TableRef in register index.
RemoveColumn
Remove the given column from the Register::TableRef in register index.
RenameColumn
Rename an existing column from the Register::TableRef in register index.
InsertDef
Start a new insertion into the Register::TableRef in register view_index.
A Register::InsertDef is stored in register index.
ColumnInsertDef
Add a column to the Register::InsertDef in register index.
RowDef
Start defining a new row of data to be inserted into the Register::InsertDef in register insert_index.
The value stored in the register index will be of type Register::InsertRow.
AddValue
Add a value to the Register::InsertRow in register index.
Insert
Fields
index: RegisterIndexPerform insertion defined in the Register::InsertRow in register index.
This represents an INSERT INTO statement.
Update
Update values of the Register::TableRef in register index.
This represents an UPDATE statement.
Union
Perform a union of the Register::TableRef in register input1 and the Register::TableRef in register input2.
The output is stored as a Register::TableRef in register
output.
CrossJoin
Perform a cartesian join of the Register::TableRef in register input1 and the Register::TableRef in register input2.
The output is stored as a Register::TableRef in register output.
NaturalJoin
Perform a natural join of the Register::TableRef in register input1 and the [Register::TableRef](crate::vm::Register::TableRef) in register input2.
The output is stored as a Register::TableRef in register output.
Note: this is both a left and a right join i.e., there will be NULLs where the common
columns do not match. The result must be filtered at a later stage.
Trait Implementationsยง
sourceยงimpl Clone for Instruction
impl Clone for Instruction
sourceยงfn clone(&self) -> Instruction
fn clone(&self) -> Instruction
1.0.0 ยท sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresourceยงimpl Debug for Instruction
impl Debug for Instruction
sourceยงimpl Display for Instruction
impl Display for Instruction
sourceยงimpl PartialEq<Instruction> for Instruction
impl PartialEq<Instruction> for Instruction
sourceยงfn eq(&self, other: &Instruction) -> bool
fn eq(&self, other: &Instruction) -> bool
self and other values to be equal, and is used
by ==.