srowen commented on a change in pull request #29836:
URL: https://github.com/apache/spark/pull/29836#discussion_r492687623



##########
File path: 
streaming/src/main/scala/org/apache/spark/streaming/DStreamGraph.scala
##########
@@ -29,8 +28,8 @@ import org.apache.spark.util.Utils
 
 final private[streaming] class DStreamGraph extends Serializable with Logging {
 
-  private val inputStreams = new ArrayBuffer[InputDStream[_]]()
-  private val outputStreams = new ArrayBuffer[DStream[_]]()
+  private var inputStreams = Array.empty[InputDStream[_]]

Review comment:
       What about using mutable.Seq? does that also work?
   This probably is OK to use an Array as setting the streams isn't called many 
times though

##########
File path: 
streaming/src/main/scala/org/apache/spark/streaming/DStreamGraph.scala
##########
@@ -29,8 +28,8 @@ import org.apache.spark.util.Utils
 
 final private[streaming] class DStreamGraph extends Serializable with Logging {
 
-  private val inputStreams = new ArrayBuffer[InputDStream[_]]()
-  private val outputStreams = new ArrayBuffer[DStream[_]]()
+  private var inputStreams = Array.empty[InputDStream[_]]

Review comment:
       mutable.ArraySeq sounds best, if that exists in 2.12 and 2.13.

##########
File path: 
streaming/src/main/scala/org/apache/spark/streaming/DStreamGraph.scala
##########
@@ -29,8 +29,8 @@ import org.apache.spark.util.Utils
 
 final private[streaming] class DStreamGraph extends Serializable with Logging {
 
-  private val inputStreams = new ArrayBuffer[InputDStream[_]]()
-  private val outputStreams = new ArrayBuffer[DStream[_]]()
+  private var inputStreams = mutable.ArraySeq.empty[InputDStream[_]]

Review comment:
       This no longer has to be a var - can leave it a val

##########
File path: 
streaming/src/main/scala/org/apache/spark/streaming/DStreamGraph.scala
##########
@@ -29,8 +29,8 @@ import org.apache.spark.util.Utils
 
 final private[streaming] class DStreamGraph extends Serializable with Logging {
 
-  private val inputStreams = new ArrayBuffer[InputDStream[_]]()
-  private val outputStreams = new ArrayBuffer[DStream[_]]()
+  private var inputStreams = mutable.ArraySeq.empty[InputDStream[_]]

Review comment:
       Just do as before: `+=`

##########
File path: 
streaming/src/main/scala/org/apache/spark/streaming/DStreamGraph.scala
##########
@@ -29,8 +29,8 @@ import org.apache.spark.util.Utils
 
 final private[streaming] class DStreamGraph extends Serializable with Logging {
 
-  private val inputStreams = new ArrayBuffer[InputDStream[_]]()
-  private val outputStreams = new ArrayBuffer[DStream[_]]()
+  private var inputStreams = mutable.ArraySeq.empty[InputDStream[_]]

Review comment:
       Oh, ArraySeq can't be appended. OK then I guess anything is fine




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to