MaxGekk commented on a change in pull request #35433:
URL: https://github.com/apache/spark/pull/35433#discussion_r805661276



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/RelationalGroupedDataset.scala
##########
@@ -452,7 +453,14 @@ class RelationalGroupedDataset protected[sql](
       case RelationalGroupedDataset.GroupByType =>
         val valueExprs = values.map(_ match {
           case c: Column => c.expr
-          case v => Literal.apply(v)
+          case v =>
+            try {
+              Literal.apply(v)
+            } catch {
+              case _: SparkRuntimeException =>
+                throw QueryExecutionErrors.pivotColumnUnsupportedError(
+                  v, pivotColumn.expr.dataType)

Review comment:
       This can fit to one line (100 chars):
   ```suggestion
                   throw QueryExecutionErrors.pivotColumnUnsupportedError(v, 
pivotColumn.expr.dataType)
   ```




-- 
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