You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/03/25 11:11:39 UTC

[GitHub] [spark] HyukjinKwon commented on a change in pull request #24182: [SPARK-27246][SQL]scalar subquery with no column test fails as it is throwing NoSuchElementException instead of AnalysisException

HyukjinKwon commented on a change in pull request #24182: [SPARK-27246][SQL]scalar subquery with no column test fails as it is throwing NoSuchElementException instead of AnalysisException
URL: https://github.com/apache/spark/pull/24182#discussion_r268588048
 
 

 ##########
 File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/subquery.scala
 ##########
 @@ -248,7 +248,10 @@ case class ScalarSubquery(
     children: Seq[Expression] = Seq.empty,
     exprId: ExprId = NamedExpression.newExprId)
   extends SubqueryExpression(plan, children, exprId) with Unevaluable {
-  override def dataType: DataType = plan.schema.fields.head.dataType
+  override def dataType: DataType = {
+    assert(!plan.schema.fields.isEmpty, "scalar subquery does not have any column")
 
 Review comment:
   Can we use `plan.schema. fields.nonEmpty` instead?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org