@@ -988,41 +988,6 @@ class DataFrame private[sql](
988988 GroupedData (this , colNames.map(colName => resolve(colName)), GroupedData .CubeType )
989989 }
990990
991- /**
992- * (Scala-specific) Pivots a column of the current [[DataFrame ]] and preform the specified
993- * aggregation.
994- * {{{
995- * // Compute the sum of earnings for each year by course with each course as a separate column.
996- * df.pivot(Seq($"year"), $"course", Seq("dotNET", "Java"), sum($"earnings"))
997- * }}}
998- * @param groupBy Columns to group by.
999- * @param pivotColumn Column to pivot
1000- * @param pivotValues Values of pivotColumn that will be translated to columns in the output data
1001- * frame.
1002- * @param aggregate Aggregate expression to preform for each combination of groupBy and
1003- * pivotValues.
1004- * @group dfops
1005- * @since 1.6.0
1006- */
1007- def pivot (
1008- groupBy : Seq [Column ],
1009- pivotColumn : Column ,
1010- pivotValues : Seq [String ],
1011- aggregate : Column ): DataFrame = {
1012-
1013- val aliasedGroupBy = groupBy.map(_.expr).map {
1014- // Wrap UnresolvedAttribute with UnresolvedAlias, as when we resolve UnresolvedAttribute, we
1015- // will remove intermediate Alias for ExtractValue chain, and we need to alias it again to
1016- // make it a NamedExpression.
1017- case u : UnresolvedAttribute => UnresolvedAlias (u)
1018- case expr : NamedExpression => expr
1019- case expr : Expression => Alias (expr, expr.prettyString)()
1020- }
1021-
1022- new DataFrame (sqlContext,
1023- Pivot (aliasedGroupBy, pivotColumn.expr, pivotValues, Seq (aggregate.expr), this .logicalPlan))
1024- }
1025-
1026991 /**
1027992 * (Scala-specific) Aggregates on the entire [[DataFrame ]] without groups.
1028993 * {{{
0 commit comments