Skip to content

Commit a8d14cc

Browse files
committed
[SPARK-12410][STREAMING] Fix places that use '.' and '|' directly in split
String.split accepts a regular expression, so we should escape "." and "|". Author: Shixiong Zhu <shixiong@databricks.com> Closes apache#10361 from zsxwing/reg-bug. (cherry picked from commit 540b5ae) Signed-off-by: Shixiong Zhu <shixiong@databricks.com>
1 parent 0fdf554 commit a8d14cc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

examples/src/main/scala/org/apache/spark/examples/ml/MovieLensALS.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object MovieLensALS {
5050
def parseMovie(str: String): Movie = {
5151
val fields = str.split("::")
5252
assert(fields.size == 3)
53-
Movie(fields(0).toInt, fields(1), fields(2).split("|"))
53+
Movie(fields(0).toInt, fields(1), fields(2).split("\\|"))
5454
}
5555
}
5656

streaming/src/main/scala/org/apache/spark/streaming/util/FileBasedWriteAheadLog.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private[streaming] object FileBasedWriteAheadLog {
231231

232232
def getCallerName(): Option[String] = {
233233
val stackTraceClasses = Thread.currentThread.getStackTrace().map(_.getClassName)
234-
stackTraceClasses.find(!_.contains("WriteAheadLog")).flatMap(_.split(".").lastOption)
234+
stackTraceClasses.find(!_.contains("WriteAheadLog")).flatMap(_.split("\\.").lastOption)
235235
}
236236

237237
/** Convert a sequence of files to a sequence of sorted LogInfo objects */

0 commit comments

Comments
 (0)