Skip to content

Commit

Permalink
Extracting a new function for refilling currentChunk.
Browse files Browse the repository at this point in the history
This change make it possible to override guaranteeFill in subclasses

#14: Refactor GpuFilteredRDD and FilteredChunkItrator 

Task-Url: http://github.com/meisam/spark/issues/issue/14
  • Loading branch information
meisam committed Oct 23, 2014
1 parent 369a9b9 commit c18ee19
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/src/main/scala/org/apache/spark/rdd/GpuRDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,16 @@ class ChunkIterator[T <: Product : ClassTag]
protected val currentChunk: RDDChunk[T] = new RDDChunk[T](columnTypes, chunkCapacity)

override def next(): T = {
guaranteeFill
val t: T = currentChunk(currentPosition)
currentPosition += 1
t
}

def guaranteeFill {
if (currentPosition >= currentChunk.size || currentPosition < 0) {
currentChunk.fill(itr)
currentPosition = 0
}
val t: T = currentChunk(currentPosition)
currentPosition += 1
t
}
}

0 comments on commit c18ee19

Please sign in to comment.