Skip to content

Commit 2ad7bd3

Browse files
Ken Takagiwagiwa
Ken Takagiwa
authored andcommitted
clean up codes
1 parent 6197a11 commit 2ad7bd3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

python/pyspark/streaming/dstream.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def _sum(self):
5656
"""
5757
Add up the elements in this DStream.
5858
"""
59-
return self._mapPartitions(lambda x: [sum(x)]).reduce(operator.add)
59+
pass
60+
#return self._mapPartitions(lambda x: [sum(x)]).reduce(operator.add)
6061

6162
def print_(self, label=None):
6263
"""
@@ -152,7 +153,7 @@ def combineLocally(iterator):
152153
else:
153154
combiners[k] = mergeValue(combiners[k], v)
154155
return combiners.iteritems()
155-
locally_combined = self.mapPartitions(combineLocally)
156+
locally_combined = self._mapPartitions(combineLocally)
156157
shuffled = locally_combined.partitionBy(numPartitions)
157158

158159
def _mergeCombiners(iterator):

streaming/src/main/scala/org/apache/spark/streaming/dstream/DStream.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ abstract class DStream[T: ClassTag] (
620620
new ForEachDStream(this, context.sparkContext.clean(foreachFunc)).register()
621621
}
622622

623-
//TODO move pyprint to PythonDStream and executed by py4j call back function
623+
//TODO: move pyprint to PythonDStream and executed by py4j call back function
624624
/**
625625
* Print the first ten elements of each PythonRDD generated in this PythonDStream. This is an output
626626
* operator, so this PythonDStream will be registered as an output stream and there materialized.
@@ -644,6 +644,7 @@ abstract class DStream[T: ClassTag] (
644644

645645
// pythonExec should be passed from python. Move pyprint to PythonDStream
646646
val pythonExec = new ProcessBuilder().environment().get("PYSPARK_PYTHON")
647+
647648
val sparkHome = new ProcessBuilder().environment().get("SPARK_HOME")
648649
// Call python script to deserialize and print result in stdout
649650
val pb = new ProcessBuilder(pythonExec, sparkHome + "/python/pyspark/streaming/pyprint.py", tempFile.getAbsolutePath)

0 commit comments

Comments
 (0)