Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexedRDD for accelerated joins #848

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions core/src/main/scala/spark/PairRDDFunctions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,17 @@ class PairRDDFunctions[K: ClassManifest, V: ClassManifest](
*/
def values: RDD[V] = self.map(_._2)


def indexed(numPartitions: Int): IndexedRDD[K,V] =
IndexedRDD(self.partitionBy(new HashPartitioner(numPartitions)))

def indexed(partitioner: Partitioner): IndexedRDD[K,V] =
IndexedRDD(self.partitionBy(partitioner))


def indexed(existingIndex: RDD[BlockIndex[K]] = null): IndexedRDD[K,V] =
IndexedRDD(self, existingIndex)

private[spark] def getKeyClass() = implicitly[ClassManifest[K]].erasure

private[spark] def getValueClass() = implicitly[ClassManifest[V]].erasure
Expand Down
9 changes: 9 additions & 0 deletions core/src/main/scala/spark/RDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ import spark.rdd.ZippedRDD
import spark.rdd.ZippedPartitionsRDD2
import spark.rdd.ZippedPartitionsRDD3
import spark.rdd.ZippedPartitionsRDD4

import spark.rdd.{IndexedRDD, BlockIndex}

import spark.storage.StorageLevel
import spark.util.BoundedPriorityQueue

Expand Down Expand Up @@ -770,6 +773,12 @@ abstract class RDD[T: ClassManifest](
return buf.toArray
}


def makeIndex(partitioner: Option[Partitioner] = None): RDD[BlockIndex[T]] =
IndexedRDD.makeIndex(this, partitioner)



/**
* Return the first element in this RDD.
*/
Expand Down
Loading