EnricoMi commented on code in PR #37407:
URL: https://github.com/apache/spark/pull/37407#discussion_r958680962
##########
sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -2094,6 +2095,23 @@ class Dataset[T] private[sql](
* This is equivalent to calling `Dataset#unpivot(Array, Array, String,
String)`
* where `values` is set to all non-id columns that exist in the DataFrame.
*
+ * Note: A column that is referenced by an id column expression is
considered an id column itself.
+ * For instance `$"id" * 2` references column `id`, so `id` is considered an
id column and not a
+ * value column:
+ * {{{
+ * val df = Seq((1, 11, 12L), (2, 21, 22L)).toDF("id", "int", "long")
+ * df.unpivot(Array($"id" * 2), "var", "val").show()
+ * // output:
+ * // +--------+--------+-----+
+ * // |(id * 2)|variable|value|
+ * // +--------+--------+-----+
+ * // | 2| int| 11|
+ * // | 2| long| 12|
+ * // | 4| int| 21|
+ * // | 4| long| 22|
+ * // +--------+--------+-----+
Review Comment:
fixed
--
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]