mapValues

inline fun <KEY, VALUE, R> KeyValueGroupedDataset<KEY, VALUE>.mapValues(noinline func: (VALUE) -> R): KeyValueGroupedDataset<KEY, R>

Returns a new KeyValueGroupedDataset where the given function func has been applied to the data. The grouping key is unchanged by this.

// Create values grouped by key from a Dataset<Arity2<K, V>>
ds.groupByKey { it._1 }.mapValues { it._2 }

fun <K, V, U> JavaRDD<Tuple2<K, V>>.mapValues(f: (V) -> U): JavaRDD<Tuple2<K, U>>

Pass each value in the key-value pair RDD through a map function without changing the keys; this also retains the original RDD's partitioning.


fun <K, V, U> JavaDStream<Tuple2<K, V>>.mapValues(mapValuesFunc: (V) -> U): JavaDStream<Tuple2<K, U>>

Return a new DStream by applying a map function to the value of each key-value pairs in 'this' DStream without changing the key.