Skip to content

RuntimeReplaceable Expressions

RuntimeReplaceable is an extension of the Expression abstraction for expressions that are replaced by Logical Optimizer with replacement expression (that can then be evaluated).

Note

Catalyst Optimizer uses ReplaceExpressions logical optimization to replace RuntimeReplaceable expressions.

RuntimeReplaceable contract allows for expression aliases, i.e. expressions that are fairly complex in the inside than on the outside, and is used to provide compatibility with other SQL databases by supporting SQL functions with their more complex Catalyst expressions (that are already supported by Spark SQL).

Note

RuntimeReplaceables are tied up to their SQL functions in FunctionRegistry.

Note

To make sure the explain plan and expression SQL works correctly, a RuntimeReplaceable implementation should override flatArguments and sql methods.

Contract

Replacement Expression

replacement: Expression

See:

Used (mainly) when:

Implementations