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

    https://github.com/apache/spark/pull/17713#discussion_r115154162
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
 ---
    @@ -137,32 +137,46 @@ 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
    +               |number of columns in the output of subquery.
    +               |#columns in left hand side: ${valExprs.length}.
    +               |#columns in right hand side: ${sub.output.length}.
    +               |Left side columns:
    +               |[${valExprs.map(_.sql).mkString(", ")}].
    +               |Right side columns:
    +               |[${sub.output.map(_.sql).mkString(", ")}].
    +               |Subquery expression id: #${exprId.id}
    --- End diff --
    
    `Subquery expression id: #${exprId.id}` does not help to the end users, I 
think


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to