Enum 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.

Fields

ยง

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

Create a new empty Register::TableRef.

Fields

ยง

NonExistent

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

Fields

ยง

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.

Fields

ยงascending: bool
ยง

Limit

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

This represents the LIMIT clause in SQL.

Fields

ยงlimit: u64
ยง

Return

Return from register at index.

Some values stored in a register may be intermediate values and cannot be returned. See Register for more information.

Fields

ยง

NewSchema

Create a new schema.

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

Fields

ยงschema_name: SchemaRef
ยงexists_ok: bool

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

ยง

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.

Fields

ยงname: BoundedString

The column name.

ยงdata_type: DataType
ยง

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.

Fields

ยงtable_reg_index: RegisterIndex
ยง

NewTable

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.

Fields

ยงexists_ok: bool

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

ยง

DropTable

Drop the table referenced by the Register::TableRef in register index.

Fields

ยง

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.

Fields

ยงtable_reg_index: RegisterIndex
ยง

ColumnInsertDef

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

Fields

ยงinsert_index: RegisterIndex
ยง

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.

Fields

ยงinsert_index: RegisterIndex
ยง

AddValue

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

Fields

ยง

Insert

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

This represents an INSERT INTO statement.

Fields

ยง

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

Sourceยง

fn clone(&self) -> Instruction

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl Debug for Instruction

Sourceยง

fn fmt(&self, fmt_derive_formatter_variable: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl Display for Instruction

Sourceยง

fn fmt(&self, fmt_derive_formatter_variable: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl PartialEq for Instruction

Sourceยง

fn eq(&self, other: &Instruction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 ยท Sourceยง

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Sourceยง

impl StructuralPartialEq for Instruction

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

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

Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T> ToString for T
where T: Display + ?Sized,

Sourceยง

fn to_string(&self) -> String

Converts the given value to a String. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.