Skip to content

InSubqueryExec Expression

InSubqueryExec is a ExecSubqueryExpression that represents InSubquery and DynamicPruningSubquery expressions at execution time.

Creating Instance

InSubqueryExec takes the following to be created:

InSubqueryExec is created when:

Broadcasted Result

resultBroadcast: Broadcast[Array[Any]]

InSubqueryExec is given a broadcast variable when created. It is uninitialized (null).

resultBroadcast is updated when InSubqueryExec is requested to update the collected result.

Interpreted Expression Evaluation

eval(
  input: InternalRow): Any

eval prepareResult.

eval requests the child expression to evaluate for the given InternalRow.

eval returns:

  • null for null evaluation result
  • true when the result contains the evaluation result or false

eval is part of the Expression abstraction.

Code-Generated Expression Evaluation

doGenCode(
  ctx: CodegenContext,
  ev: ExprCode): ExprCode

doGenCode prepareResult.

doGenCode creates a InSet expression (with the child expression and result) and requests it to doGenCode.

doGenCode is part of the Expression abstraction.

Updating Result

updateResult(): Unit

updateResult requests the BaseSubqueryExec to executeCollect.

updateResult uses the collected result to update the result and resultBroadcast registries.

updateResult is part of the ExecSubqueryExpression abstraction.

result Internal Registry

result: Array[Any]

result...FIXME

prepareResult Internal Method

prepareResult(): Unit

prepareResult simply requests the resultBroadcast broadcast variable for the broadcasted value when result is undefined (null). Otherwise, prepareResult does nothing.

prepareResult throws an IllegalArgumentException when resultBroadcast is undefined (null):

[this] has not finished

prepareResult is used when InSubqueryExec expression is evaluated (interpreted or code-generated).


Last update: 2020-10-21