pub struct LiteralLifting { /* private fields */ }
Expand description

Hoist literal values from maps wherever possible.

Implementations

Hoist literal values from maps wherever possible.

Returns a list of literal scalar expressions that must be appended to the result before it can be correctly used. The intent is that this action extracts a maximal set of literals from relation, which can then often be propagated further up and inlined in any expressions as it goes.

In several cases, we only manage to extract literals from the final columns. But in those cases where it is possible, permutations are used to move all of the literals to the final columns, and then rely on projection hoisting to allow the these literals to move up the AST.

TODO: The literals from the final columns are returned as the result of this method, whereas literals in intermediate columns are extracted using permutations. The reason for this different treatment is that in some cases it is not possible to remove the projection of the permutation, preventing the lifting of a literal that could otherwise be lifted, the following example being of them:

%0 = | Constant (1, 2, 3) (2, 2, 3)

%1 = | Constant (4, 3, 3) (4, 5, 3)

%2 = | Union %0 %1

If final literals weren’t treated differently, the example above would lead to the following transformed plan:

%0 = | Constant (1) (2) | Map 2, 3 | Project (#0..#2)

%1 = | Constant (3) (5) | Map 4, 3 | Project (#1, #0, #2)

%2 = | Union %0 %1

Since the union branches have different projections, they cannot be removed, preventing literal 3 from being lifted further.

In theory, all literals could be treated in the same way if this method returned both a list of literals and a projection vector, making the caller have to deal with the reshuffling. (see https://github.com/MaterializeInc/materialize/issues/6598)

Trait Implementations

Extracts a reference to the recursion guard embedded within the type.
Checks whether it is safe to recur and calls f if so. Read more
Like CheckedRecursion::checked_recur, but operates on a mutable reference to Self. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Transform a relation into a functionally equivalent relation.
A string describing the transform. Read more

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.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Attaches the current Context to this type, returning a WithContext wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Wrap the input message T in a tonic::Request
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
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.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more