Skip to content
Snippets Groups Projects
Commit acb03230 authored by Hossein Falaki's avatar Hossein Falaki
Browse files

minor improvements

parent d6cded71
No related branches found
No related tags found
No related merge requests found
......@@ -229,9 +229,8 @@ class PairRDDFunctions[K: ClassTag, V: ClassTag](self: RDD[(K, V)])
}
val mergeHLL = (h1: SerializableHyperLogLog, h2: SerializableHyperLogLog) => h1.merge(h2)
combineByKey(createHLL, mergeValueHLL, mergeHLL, partitioner).map {
case (k, v) => (k, v.value.cardinality())
}
combineByKey(createHLL, mergeValueHLL, mergeHLL, partitioner).mapValues(_.value.cardinality())
}
/**
......
......@@ -809,7 +809,9 @@ abstract class RDD[T: ClassTag](
}
def mergeCounters(c1: SerializableHyperLogLog, c2: SerializableHyperLogLog) = c1.merge(c2)
mapPartitions(hllCountPartition).reduce(mergeCounters).value.cardinality()
val zeroCounter = new SerializableHyperLogLog(new HyperLogLog(relativeSD))
mapPartitions(hllCountPartition).aggregate(zeroCounter)(mergeCounters, mergeCounters)
.value.cardinality()
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment