Skip to content

Commit 325af7d

Browse files
committed
Fix two spaces after eq in places
1 parent cd69b2e commit 325af7d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/main/scala/com/high-performance-spark-examples/goldilocks/GoldilocksWithHashMap.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ object GoldilocksWithHashMap {
4545
val sortedAggregatedValueColumnPairs = aggregatedValueColumnPairs.sortByKey()
4646
sortedAggregatedValueColumnPairs.persist(StorageLevel.MEMORY_AND_DISK)
4747

48-
val numOfColumns = dataFrame.schema.length
48+
val numOfColumns = dataFrame.schema.length
4949
val partitionColumnsFreq =
5050
getColumnsFreqPerPartition(sortedAggregatedValueColumnPairs, numOfColumns)
5151
val ranksLocations =
@@ -79,7 +79,7 @@ object GoldilocksWithHashMap {
7979
def getAggregatedValueColumnPairs(dataFrame: DataFrame):
8080
RDD[((Double, Int), Long)] = {
8181

82-
val aggregatedValueColumnRDD = dataFrame.rdd.mapPartitions(rows => {
82+
val aggregatedValueColumnRDD = dataFrame.rdd.mapPartitions(rows => {
8383
val valueColumnMap = new mutable.HashMap[(Double, Int), Long]()
8484
rows.foreach(row => {
8585
row.toSeq.zipWithIndex.foreach{ case (value, columnIndex) =>
@@ -312,7 +312,7 @@ object FindTargetsSubRoutine extends Serializable {
312312
// A HashMap with the running totals of each column index. As we loop through
313313
// the iterator. We will update the hashmap as we see elements of each
314314
// column index.
315-
val runningTotals : mutable.HashMap[Int, Long]= new mutable.HashMap()
315+
val runningTotals : mutable.HashMap[Int, Long]= new mutable.HashMap()
316316
runningTotals ++= columnsInThisPart.map(columnIndex => (columnIndex, 0L)).toMap
317317

318318
//we use an array buffer to build the resulting iterator
@@ -327,7 +327,7 @@ object FindTargetsSubRoutine extends Serializable {
327327
val total = runningTotals(colIndex)
328328
//the ranks that are contains by this element of the input iterator.
329329
//get by filtering the
330-
val ranksPresent = columnsRelativeIndex(colIndex)
330+
val ranksPresent = columnsRelativeIndex(colIndex)
331331
.filter(index => (index <= count + total) && (index > total))
332332
ranksPresent.foreach(r => result += ((colIndex, value)))
333333
//update the running totals.
@@ -352,11 +352,11 @@ object FindTargetsSubRoutine extends Serializable {
352352
val columnsRelativeIndex = targetsInThisPart.groupBy(_._1).mapValues(_.map(_._2))
353353
val columnsInThisPart = targetsInThisPart.map(_._1).distinct
354354

355-
val runningTotals : mutable.HashMap[Int, Long]= new mutable.HashMap()
355+
val runningTotals : mutable.HashMap[Int, Long]= new mutable.HashMap()
356356
runningTotals ++= columnsInThisPart.map(columnIndex => (columnIndex, 0L)).toMap
357357

358358
//filter out the pairs that don't have a column index that is in this part
359-
val pairsWithRanksInThisPart = valueColumnPairsIter.filter{
359+
val pairsWithRanksInThisPart = valueColumnPairsIter.filter{
360360
case (((value, colIndex), count)) =>
361361
columnsInThisPart contains colIndex
362362
}

src/test/scala/com/high-performance-spark-examples/goldilocks/EvaluationTests.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import org.scalatest.FunSuite
66

77
class EvaluationTests extends FunSuite with SharedSparkContext {
88
val doubleList = Array(1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0)
9-
val keyValuePairs = Array(1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0).zipWithIndex
9+
val keyValuePairs = Array(1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0).zipWithIndex
1010
val path = "target/testResults"
1111

1212
test("MapValues preserves Partitioning "){
@@ -28,7 +28,7 @@ class EvaluationTests extends FunSuite with SharedSparkContext {
2828
val b = Array(3, 4)
2929
val rddA = sc.parallelize(a)
3030
val rddB = sc.parallelize(b)
31-
val rddC = rddA.subtract(rddB)
31+
val rddC = rddA.subtract(rddB)
3232
assert(rddC.count() < rddA.count() - rddB.count())
3333
// end::Subtract[]
3434
}
@@ -39,7 +39,7 @@ class EvaluationTests extends FunSuite with SharedSparkContext {
3939
val b = Array(3, 4)
4040
val rddA = sc.parallelize(a)
4141
val rddB = sc.parallelize(b)
42-
val intersection = rddA.intersection(rddB)
42+
val intersection = rddA.intersection(rddB)
4343
val subtraction = rddA.subtract(rddB)
4444
val union = intersection.union(subtraction)
4545
assert(!rddA.collect().sorted.sameElements(union.collect().sorted))

src/test/scala/com/high-performance-spark-examples/goldilocks/GoldilocksLargeTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ object DataCreationUtils {
6767

6868
val cols = Range(0,numberCols).toArray
6969
val scalers = cols.map(x => 1.0)
70-
val rowRange = Range(0, numberOfRows)
70+
val rowRange = Range(0, numberOfRows)
7171
val columnArray: Array[IndexedSeq[Double]] = cols.map(
7272
columnIndex => {
7373
val columnValues = rowRange.map(

0 commit comments

Comments
 (0)