You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by gatorsmile <gi...@git.apache.org> on 2017/06/23 06:42:36 UTC

[GitHub] spark pull request #17713: [SPARK-20417][SQL] Move subquery error handling t...

Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17713#discussion_r123681616
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala ---
    @@ -139,32 +139,44 @@ case class In(value: Expression, list: Seq[Expression]) extends Predicate {
       require(list != null, "list should not be null")
       override def checkInputDataTypes(): TypeCheckResult = {
         list match {
    -      case ListQuery(sub, _, _) :: Nil =>
    +      case ListQuery(sub, _, exprId) :: Nil =>
             val valExprs = value match {
               case cns: CreateNamedStruct => cns.valExprs
               case expr => Seq(expr)
             }
    -
    -        val mismatchedColumns = valExprs.zip(sub.output).flatMap {
    -          case (l, r) if l.dataType != r.dataType =>
    -            s"(${l.sql}:${l.dataType.catalogString}, ${r.sql}:${r.dataType.catalogString})"
    -          case _ => None
    -        }
    -
    -        if (mismatchedColumns.nonEmpty) {
    +        if (valExprs.length != sub.output.length) {
               TypeCheckResult.TypeCheckFailure(
                 s"""
    -               |The data type of one or more elements in the left hand side of an IN subquery
    -               |is not compatible with the data type of the output of the subquery
    -               |Mismatched columns:
    -               |[${mismatchedColumns.mkString(", ")}]
    -               |Left side:
    -               |[${valExprs.map(_.dataType.catalogString).mkString(", ")}].
    -               |Right side:
    -               |[${sub.output.map(_.dataType.catalogString).mkString(", ")}].
    +               |The number of columns the left hand side of an IN subquery does not match the
    --- End diff --
    
    `The number of columns the left` -> `The number of columns in the left`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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