Skip to content

Commit 5507cad

Browse files
committed
All examples under spark scala - String interpolation has implemented - 2
1 parent 8d729fa commit 5507cad

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

examples/src/main/scala/org/apache/spark/examples/SimpleSkewedGroupByTest.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ object SimpleSkewedGroupByTest {
6060
pairs1.count
6161

6262
println(s"RESULT: ${pairs1.groupByKey(numReducers).count}")
63-
// Print how many keys each reducer got (for debugging)
64-
// println("RESULT: " + pairs1.groupByKey(numReducers)
65-
// .map{case (k,v) => (k, v.size)}
66-
// .collectAsMap)
6763

6864
spark.stop()
6965
}

examples/src/main/scala/org/apache/spark/examples/ml/DecisionTreeRegressionExample.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ object DecisionTreeRegressionExample {
7373
.setPredictionCol("prediction")
7474
.setMetricName("rmse")
7575
val rmse = evaluator.evaluate(predictions)
76-
println("Root Mean Squared Error (RMSE) on test data = " + rmse)
76+
println(s"Root Mean Squared Error (RMSE) on test data = $rmse")
7777

7878
val treeModel = model.stages(1).asInstanceOf[DecisionTreeRegressionModel]
79-
println("Learned regression tree model:\n" + treeModel.toDebugString)
79+
println(s"Learned regression tree model:\n ${treeModel.toDebugString}")
8080
// $example off$
8181

8282
spark.stop()

examples/src/main/scala/org/apache/spark/examples/ml/VectorIndexerExample.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ object VectorIndexerExample {
4141
val indexerModel = indexer.fit(data)
4242

4343
val categoricalFeatures: Set[Int] = indexerModel.categoryMaps.keys.toSet
44-
println(s"Chose ${categoricalFeatures.size} categorical features: " +
45-
categoricalFeatures.mkString(", "))
44+
println(s"Chose ${categoricalFeatures.size} " +
45+
s"categorical features: {$categoricalFeatures.mkString(", ")}")
4646

4747
// Create new column "indexed" with categorical values transformed to indices
4848
val indexedData = indexerModel.transform(data)

0 commit comments

Comments
 (0)