beliefer commented on code in PR #38973:
URL: https://github.com/apache/spark/pull/38973#discussion_r1043045096


##########
connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala:
##########
@@ -309,6 +310,28 @@ class SparkConnectPlanner(session: SparkSession) {
     UnresolvedHint(rel.getName, params, transformRelation(rel.getInput))
   }
 
+  private def transformMelt(rel: proto.Melt): LogicalPlan = {
+    val ids = rel.getIdsList.asScala.toArray.map { expr =>
+      Column(transformExpression(expr))
+    }
+
+    if (rel.getValuesList.isEmpty) {
+      Dataset
+        .ofRows(session, transformRelation(rel.getInput))
+        .melt(ids, rel.getVariableColumnName, rel.getValueColumnName)

Review Comment:
   It will throws
   ```
   org.apache.spark.sql.AnalysisException: [UNPIVOT_REQUIRES_VALUE_COLUMNS] At 
least one value column needs to be specified for UNPIVOT, all columns specified 
as ids;
   'Unpivot ArraySeq(id#25), ArraySeq(), variable, [value]
   +- LocalRelation <empty>, [id#25, name#26]
   ```



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