cloud-fan commented on code in PR #36150:
URL: https://github.com/apache/spark/pull/36150#discussion_r922266752


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/errors/QueryCompilationErrors.scala:
##########
@@ -92,6 +92,19 @@ private[sql] object QueryCompilationErrors extends 
QueryErrorsBase {
         pivotVal.toString, pivotVal.dataType.simpleString, 
pivotCol.dataType.catalogString))
   }
 
+  def unpivotRequiresValueColumns(ids: Seq[NamedExpression]): Throwable = {
+    new AnalysisException(
+      errorClass = "UNPIVOT_REQUIRES_VALUE_COLUMNS",
+      messageParameters = Array(ids.map(id => 
toSQLId(id.toString)).mkString(", ")))
+  }
+
+  def unpivotValDataTypeMismatchError(values: Seq[NamedExpression]): Throwable 
= {
+    val dataTypes = values.map(_.dataType).toSet.map((dt: DataType) => 
toSQLType(dt))

Review Comment:
   `toSet` removes duplicated types, but I think it's easier for users to find 
out which value column is problematic, if they can match type and columns by 
ordinal.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to