Skip to content

BindParameters Logical Analysis Rule

BindParameters is a logical evaluation rule (Rule[LogicalPlan]).

BindParameters is part of Substitution fixed-point batch of rules.

Executing Rule

  plan: LogicalPlan): LogicalPlan

apply is part of the Rule abstraction.

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:

apply checks the arguments and replaces the names (or the positions) with their corresponding Literals.


  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

  args: Iterable[(String, Expression)]): Unit

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.