Skip to content

Commit 315f8ce

Browse files
committed
fix mapValues examples in comments
1 parent 3494ec5 commit 315f8ce

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

sql/core/src/main/scala/org/apache/spark/sql/KeyValueGroupedDataset.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class KeyValueGroupedDataset[K, V] private[sql](
7070
*
7171
* {{{
7272
* // Create values grouped by key from a Dataset[(K, V)]
73-
* ds.groupBy(_._1).mapValues(_._2)
73+
* ds.groupByKey(_._1).mapValues(_._2) // Scala
7474
* }}}
7575
* @since 2.0.0
7676
*/
@@ -92,8 +92,10 @@ class KeyValueGroupedDataset[K, V] private[sql](
9292
* data. The grouping key is unchanged by this.
9393
*
9494
* {{{
95-
* // Create values grouped by key from a Dataset[(K, V)]
96-
* ds.groupBy(_._1).mapValues(_._2)
95+
* // Create Integer values grouped by String key from a Dataset<Tuple2<String, Integer>>
96+
* Dataset<Tuple2<String, Integer>> ds = ...;
97+
* KeyValueGroupedDataset<String, Integer> grouped =
98+
* ds.groupByKey(t -> t._1, Encoders.STRING()).mapValues(t -> t._2, Encoders.INT());
9799
* }}}
98100
* @since 2.0.0
99101
*/

0 commit comments

Comments
 (0)