ScalarSubquery is an ExecSubqueryExpression that <
null if no row were computed).
IMPORTANT: Spark SQL uses the name of
ScalarSubquery twice to represent an
ExecSubqueryExpression (this page) and a SubqueryExpression. It is confusing and you should not be anymore.
ScalarSubquery is <
// FIXME DEMO import org.apache.spark.sql.execution.PlanSubqueries val spark = ... val planSubqueries = PlanSubqueries(spark) val plan = ... val executedPlan = planSubqueries(plan)
ScalarSubquery is an unevaluable expression.
ScalarSubquery uses...FIXME...for the <
[[internal-registries]] .ScalarSubquery's Internal Properties (e.g. Registries, Counters and Flags) [cols="1,2",options="header",width="100%"] |=== | Name | Description
result | [[result]] The value of the single column in a single row after collecting the rows from executing the <
null if no rows were collected.
updated | [[updated]] Flag that says whether
ScalarSubquery was <
=== [[creating-instance]] Creating ScalarSubquery Instance
ScalarSubquery takes the following when created:
- [[plan]] SubqueryExec.md[SubqueryExec] plan
- [[exprId]] Expression ID (as
=== [[updateResult]] Updating ScalarSubquery With Collected Result --
updateResult is part of spark-sql-Expression-ExecSubqueryExpression.md#updateResult[ExecSubqueryExpression Contract] to fill an Catalyst expression with a collected result from executing a subquery plan.
updateResult requests <
updateResult sets <
null if no row were collected.
In the end,
updateResult marks the
ScalarSubquery instance as <
updateResult reports a
RuntimeException when there are more than 1 rows in the result.
more than one row returned by a subquery used as an expression: [plan]
updateResult reports an
AssertionError when the number of fields is not exactly 1.
Expects 1 field, but got [numFields] something went wrong in analysis
=== [[eval]] Evaluating Expression --
eval(input: InternalRow): Any¶
eval is part of the Expression abstraction.
eval simply returns <
eval reports an
IllegalArgumentException if the
ScalarSubquery expression has not been <
=== [[doGenCode]] Generating Java Source Code (ExprCode) For Code-Generated Expression Evaluation --
doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode¶
doGenCode is part of <
doGenCode first makes sure that the <
true). If not,
doGenCode throws an
IllegalArgumentException exception with the following message:
requirement failed: [this] has not finished
doGenCode then creates a <