Skip to content

InSubqueryExec Expression

InSubqueryExec is an 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

Expression
eval(
  input: InternalRow): Any

eval is part of the Expression abstraction.

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

Code-Generated Expression Evaluation

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

doGenCode is part of the Expression abstraction.

doGenCode prepareResult.

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

Updating Result

ExecSubqueryExpression
updateResult(): Unit

updateResult is part of the ExecSubqueryExpression abstraction.

updateResult requests the BaseSubqueryExec to executeCollect.

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

result

result: Array[Any]

result...FIXME

prepareResult

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: