BindParameters Logical Analysis Rule¶
BindParameters
is a logical evaluation rule (Rule[LogicalPlan]
).
BindParameters
is part of Substitution fixed-point batch of rules.
Executing Rule¶
apply
works on LogicalPlans with PARAMETERIZED_QUERY tree pattern only.
apply
makes sure that there's exactly one ParameterizedQuery logical operator in the given LogicalPlan. Otherwise, apply
throws an AssertionError
:
One unresolved plan can have at most one ParameterizedQuery
apply
resolves the following logical operators in the given LogicalPlan:
- NameParameterizedQuery
PosParameterizedQuery
apply
checks the arguments and replaces the names (or the positions) with their corresponding Literals.
Binding¶
bind(
p: LogicalPlan)(
f: PartialFunction[Expression, Expression]): LogicalPlan
bind
resolves expressions with PARAMETER tree pattern in the given LogicalPlan (incl. SubqueryExpressions) using the given f
partial function.
Checking Arguments¶
checkArgs(
args: Iterable[(String, Expression)]): Unit
Procedure
checkArgs
is a procedure (returns Unit
) so what happens inside stays inside (paraphrasing the former advertising slogan of Las Vegas, Nevada).
checkArgs
makes sure that the Expressions in the given args
collection are all Literals.
If not, checkArgs
fails analysis with an AnalysisException
:
The argument [name] of `sql()` is invalid. Consider to replace it by a SQL literal.