Skip to content

Commit 321bbe8

Browse files
committed
updated the code style.The style from [for...yield]to [files.map(file=>{})]
1 parent 88a2c20 commit 321bbe8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ class FileInputDStream[K: ClassTag, V: ClassTag, F <: NewInputFormat[K,V] : Clas
120120

121121
/** Generate one RDD from an array of files */
122122
private def filesToRDD(files: Seq[String]): RDD[(K, V)] = {
123-
val fileRDDs = for (file <- files; rdd = context.sparkContext.newAPIHadoopFile[K, V, F](file))
124-
yield {
123+
val fileRDDs = files.map(file =>{
124+
val rdd = context.sparkContext.newAPIHadoopFile[K, V, F](file)
125125
if (rdd.partitions.size == 0) {
126126
logError("File " + file + " has no data in it. Spark Streaming can only ingest " +
127127
"files that have been \"moved\" to the directory assigned to the file stream. " +
128128
"Refer to the streaming programming guide for more details.")
129129
}
130130
rdd
131-
}
131+
})
132132
new UnionRDD(context.sparkContext, fileRDDs)
133133
}
134134

0 commit comments

Comments
 (0)