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 2022/10/06 02:42:59 UTC
[GitHub] [spark] cloud-fan commented on a diff in pull request #37407: [SPARK-39876][SQL] Add UNPIVOT to SQL syntax
cloud-fan commented on code in PR #37407:
URL: https://github.com/apache/spark/pull/37407#discussion_r988501693
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -101,16 +101,45 @@ private[sql] object QueryCompilationErrors extends QueryErrorsBase {
"pivotType" -> pivotCol.dataType.catalogString))
}
+ def unpivotRequiresAttributes(given: String,
+ empty: String,
+ expressions: Seq[NamedExpression]): Throwable = {
+ val types = expressions.groupBy(_.getClass.getSimpleName)
+ .mapValues(exprs => exprs.map(expr => expr.toString.replaceAll("#\\d+", "")).sorted)
+ .mapValues(exprs => if (exprs.length > 3) exprs.take(3) :+ "..." else exprs)
+ .toList.sortBy(_._1)
+ .map { case (className, exprs) => s"$className (${exprs.mkString(", ")})" }
Review Comment:
We should not expose too many internal information in the user-facing error message. Can we just put `expressions.filterNot(_.isInstanceOf[Attribute]).map(_.sql).mkString(", ")`?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org