Skip to content
Closed
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,24 @@ class SparkConnectStreamHandler(responseObserver: StreamObserver[Response]) exte
()
}

spark.sparkContext.runJob(batches, processPartition, resultHandler)
spark.sparkContext.submitJob(
rdd = batches,
processPartition = processPartition,
partitions = Seq.range(0, numPartitions),
resultHandler = resultHandler,
resultFunc = () => ())

// The man thread will wait until 0-th partition is available,
// then send it to client and wait for next partition.
// then send it to client and wait for the next partition.
var currentPartitionId = 0
while (currentPartitionId < numPartitions) {
val partition = signal.synchronized {
while (!partitions.contains(currentPartitionId)) {
var result = partitions.remove(currentPartitionId)
while (result.isEmpty) {
signal.wait()
result = partitions.remove(currentPartitionId)
}
partitions.remove(currentPartitionId).get
result.get
}

partition.foreach { case (bytes, count) =>
Expand Down