Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/17713#discussion_r115114133
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala
---
@@ -142,27 +142,37 @@ case class In(value: Expression, list:
Seq[Expression]) extends Predicate {
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(", ")}]
+ |The number of columns the left hand side of an IN subquery
does not match the
+ |number of columns in the output of subquery.
|Left side:
- |[${valExprs.map(_.dataType.catalogString).mkString(", ")}].
+ |${valExprs.length}.
|Right side:
- |[${sub.output.map(_.dataType.catalogString).mkString(",
")}].
- """.stripMargin)
+ |${sub.output.length}.
--- End diff --
Could we output what are left sides and what are right sides? When we have
nested subqueries in a very complex user query, it could be hard for users to
locate it.
---
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]