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

    https://github.com/apache/spark/pull/17713#discussion_r115154716
  
    --- 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 --
    
    @gatorsmile OK.. since we will have the plan information available for 
these analysis error, i was thinking it was possible to co-relate the error 
with the originating subquery expression. Let me remove it, given you think it 
may not be useful to the end-users as they may not be familiar with the system 
generated expression id.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to