InSubqueryExec Expression¶
InSubqueryExec is an ExecSubqueryExpression that represents InSubquery and DynamicPruningSubquery expressions at execution time.
Creating Instance¶
InSubqueryExec takes the following to be created:
- Child Expression
- BaseSubqueryExec physical operator
- Expression ID
- Broadcast Variable
InSubqueryExec is created when:
- PlanSubqueries physical optimization is executed (and plans InSubquery expressions)
- PlanAdaptiveSubqueries physical optimization is executed (and plans InSubquery expressions)
- PlanDynamicPruningFilters physical optimization is executed (and plans DynamicPruningSubquery expressions)
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 prepareResult.
eval requests the child expression to evaluate for the given InternalRow.
eval returns:
nullfornullevaluation resulttruewhen the result contains the evaluation result orfalse
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:
InSubqueryExecexpression is evaluated (interpreted or code-generated).