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

Fields

ยงvalue: Value

Load a Value into a register.

ยง

Expr

Fields

ยงexpr: 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

Create a new empty Register::TableRef.

ยง

NonExistent

Fields

Create a new [Register::TableRef](crate::vm::Register::TableRef) pointing to a non-existent table.

ยง

Filter

Fields

ยงexpr: Expr

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

Fields

ยงexpr: Expr

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

Fields

ยงexpr: Expr
ยงascending: bool

Order the Register::TableRef at index by the given expression.

This represents the ORDER BY clause in SQL.

ยง

Limit

Fields

ยงlimit: u64

Truncate the Register::TableRef at index to the given number of rows.

This represents the LIMIT clause in SQL.

ยง

Return

Fields

Return 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

ยงschema_name: SchemaRef
ยงexists_ok: bool

If true, the schema is not created if it exists and no error is returned.

Create a new schema.

This represents a CREATE SCHEMA [IF NOT EXISTS] statement.

ยง

ColumnDef

Fields

ยงname: BoundedString

The column name.

ยงdata_type: DataType

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

Fields

ยงtable_reg_index: RegisterIndex

Add column in register col_index to the Register::TableRef in table_reg_index.

ยง

NewTable

Fields

ยงexists_ok: bool

If true, the table is not created if it exists and no error is returned.

Create 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

Drop 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

Fields

ยงtable_reg_index: RegisterIndex

Start a new insertion into the Register::TableRef in register view_index.

A Register::InsertDef is stored in register index.

ยง

ColumnInsertDef

Fields

ยงinsert_index: RegisterIndex

Add a column to the Register::InsertDef in register index.

ยง

RowDef

Fields

ยงinsert_index: RegisterIndex

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

Fields

ยงexpr: Expr

Add a value to the Register::InsertRow in register index.

ยง

Insert

Fields

Perform insertion defined in the Register::InsertRow in register index.

This represents an INSERT INTO statement.

ยง

Update

Fields

ยงexpr: Expr

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ยง

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementationsยง

Blanket Implementationsยง

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.