[][src]Enum arcon::weld::ast::prelude::ExprKind

pub enum ExprKind {
    Literal(LiteralKind),
    Ident(Symbol),
    Not(Box<Expr>),
    Assert(Box<Expr>),
    Negate(Box<Expr>),
    Broadcast(Box<Expr>),
    BinOp {
        kind: BinOpKind,
        left: Box<Expr>,
        right: Box<Expr>,
    },
    UnaryOp {
        kind: UnaryOpKind,
        value: Box<Expr>,
    },
    Cast {
        kind: ScalarKind,
        child_expr: Box<Expr>,
    },
    ToVec {
        child_expr: Box<Expr>,
    },
    MakeStruct {
        elems: Vec<Expr>,
    },
    MakeVector {
        elems: Vec<Expr>,
    },
    Zip {
        vectors: Vec<Expr>,
    },
    GetField {
        expr: Box<Expr>,
        index: u32,
    },
    Length {
        data: Box<Expr>,
    },
    Lookup {
        data: Box<Expr>,
        index: Box<Expr>,
    },
    OptLookup {
        data: Box<Expr>,
        index: Box<Expr>,
    },
    KeyExists {
        data: Box<Expr>,
        key: Box<Expr>,
    },
    Slice {
        data: Box<Expr>,
        index: Box<Expr>,
        size: Box<Expr>,
    },
    Sort {
        data: Box<Expr>,
        cmpfunc: Box<Expr>,
    },
    Let {
        name: Symbol,
        value: Box<Expr>,
        body: Box<Expr>,
    },
    If {
        cond: Box<Expr>,
        on_true: Box<Expr>,
        on_false: Box<Expr>,
    },
    Iterate {
        initial: Box<Expr>,
        update_func: Box<Expr>,
    },
    Select {
        cond: Box<Expr>,
        on_true: Box<Expr>,
        on_false: Box<Expr>,
    },
    Lambda {
        params: Vec<Parameter>,
        body: Box<Expr>,
    },
    Apply {
        func: Box<Expr>,
        params: Vec<Expr>,
    },
    CUDF {
        sym_name: String,
        args: Vec<Expr>,
        return_ty: Box<Type>,
    },
    Serialize(Box<Expr>),
    Deserialize {
        value: Box<Expr>,
        value_ty: Box<Type>,
    },
    NewBuilder(Option<Box<Expr>>),
    For {
        iters: Vec<Iter>,
        builder: Box<Expr>,
        func: Box<Expr>,
    },
    Merge {
        builder: Box<Expr>,
        value: Box<Expr>,
    },
    Res {
        builder: Box<Expr>,
    },
}

Expressions in the Weld IR.

This enumeration defines the operators in the Weld IR. Each operator relies on zero or more sub-expressions, forming an expression tree. We use the term "expression" to refer to a particular ExprKind.

Variants

Literal(LiteralKind)

A literal expression.

Weld supports numerical scalar literals (e.g., 1.0 and -5) and ASCII string literals.

Ident(Symbol)

An identifier.

Not(Box<Expr>)

Invert a boolean expression.

Assert(Box<Expr>)

Asserts that the child expression is true. If it isn't, an error is thrown. Otherwise, this expression always returns true.

NOTE: Assert currently causes a panic.

Negate(Box<Expr>)

Negates a numerical expression.

Broadcast(Box<Expr>)

Broadcasts a scalar into a vector.

BinOp

Applies a binary operator to the child expressions.

Fields of BinOp

kind: BinOpKindleft: Box<Expr>right: Box<Expr>
UnaryOp

Applies a unary operator to the child expressions.

Fields of UnaryOp

kind: UnaryOpKindvalue: Box<Expr>
Cast

Cast a scalar or SIMD child expression to another type.

Fields of Cast

kind: ScalarKindchild_expr: Box<Expr>
ToVec

Convert a dictionary into a vector of key/value pairs.

Fields of ToVec

child_expr: Box<Expr>
MakeStruct

Construct a struct from a list of child expressions.

Fields of MakeStruct

elems: Vec<Expr>
MakeVector

Construct a vector from a list of child expressions.

Fields of MakeVector

elems: Vec<Expr>
Zip

Zip vectors together for iteration.

This operator is only available within a For loop.

Fields of Zip

vectors: Vec<Expr>
GetField

Access a struct field at the given index.

Fields of GetField

expr: Box<Expr>index: u32
Length

Get the length of a vector as an i64.

Fields of Length

data: Box<Expr>
Lookup

Lookup a value in a collection.

If data is a vector, index must be an i64 specifying the vector index. If data is a dictionary, index is a key. If the key is not present in the dictionary, this expression raises a KeyNotFoundError.

Fields of Lookup

data: Box<Expr>index: Box<Expr>
OptLookup

A variant of lookup on dictionaries that does not result in an error.

Returns a {bool, V}, where the bool indicates whether the value was in the dictionary.

Fields of OptLookup

data: Box<Expr>index: Box<Expr>
KeyExists

Check whether a key exists in a dictionary.

Fields of KeyExists

data: Box<Expr>key: Box<Expr>
Slice

Slices a vector, creating a view into it.

This does not allocate new data.

Fields of Slice

data: Box<Expr>index: Box<Expr>size: Box<Expr>
Sort

Sorts a vector.

The sort operator takes a vector comprised of any non-builder, non-SIMD, or non-dictionary type and returns a new sorted vector. The sort order is determined by cmpfunc.

The comparator takes two arguments x and y whose type is the vector element type and returns a positive i32 if x > y, zero if x == y, and a negative number of x < y.

Fields of Sort

data: Box<Expr>cmpfunc: Box<Expr>
Let

Assign a value to name, and then evaluate body.

The environment is updated with name before body is run.

Fields of Let

name: Symbolvalue: Box<Expr>body: Box<Expr>
If

Evaluate on_true or on_false depending on cond.

Fields of If

cond: Box<Expr>on_true: Box<Expr>on_false: Box<Expr>
Iterate

Iterate sequentially using an update function.

The initial value has type T, and the update function has type |T| -> {T, bool}. Iteration continues until the update function returns false.

Fields of Iterate

initial: Box<Expr>update_func: Box<Expr>
Select

Select on_true or on_false depending on cond.

Both on_trueand on_false are evaluated unconditionally.

Fields of Select

cond: Box<Expr>on_true: Box<Expr>on_false: Box<Expr>
Lambda

An expression representing a function.

Fields of Lambda

params: Vec<Parameter>body: Box<Expr>
Apply

Apply a function using a list of parameters.

Fields of Apply

func: Box<Expr>params: Vec<Expr>
CUDF

A C UDF called by symbol name.

Fields of CUDF

sym_name: Stringargs: Vec<Expr>return_ty: Box<Type>
Serialize(Box<Expr>)

Serialize an expression into a vector of bytes.

Deserialize

Deserialize an expression from a vector of bytes.

The expression should be serialized using Serialize.

Fields of Deserialize

value: Box<Expr>value_ty: Box<Type>
NewBuilder(Option<Box<Expr>>)

Create a new builder.

For

Update a builder in parallel by iterating over data.

Fields of For

iters: Vec<Iter>builder: Box<Expr>func: Box<Expr>
Merge

Update a builder value, returning a new builder.

Fields of Merge

builder: Box<Expr>value: Box<Expr>
Res

Consume a builder and return its result.

Fields of Res

builder: Box<Expr>

Methods

impl ExprKind[src]

pub fn name(&self) -> &str[src]

Return a readable name for the kind.

The name is independent of any subexpressions.

pub fn is_builder_expr(&self) -> bool[src]

Returns true if the expression is over builders.

Trait Implementations

impl Eq for ExprKind[src]

impl PartialEq<ExprKind> for ExprKind[src]

impl Debug for ExprKind[src]

impl Clone for ExprKind[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Hash for ExprKind[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl !Send for ExprKind

impl Unpin for ExprKind

impl !Sync for ExprKind

impl UnwindSafe for ExprKind

impl !RefUnwindSafe for ExprKind

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<T> Deserialisable<T> for T[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<K> TrieKey for K where
    K: Eq + Hash + ?Sized