Skip to content
Snippets Groups Projects
Commit e29704f9 authored by bomeng's avatar bomeng Committed by Sean Owen
Browse files

[SPARK-12136][STREAMING] rddToFileName does not properly handle prefix and suffix parameters

The original code does not properly handle the cases where the prefix is null, but suffix is not null - the suffix should be used but is not.

The fix is using StringBuilder to construct the proper file name.

Author: bomeng <bmeng@us.ibm.com>
Author: Bo Meng <mengbo@bos-macbook-pro.usca.ibm.com>

Closes #10185 from bomeng/SPARK-12136.
parent d8ec081c
No related branches found
No related tags found
No related merge requests found
...@@ -892,12 +892,13 @@ object StreamingContext extends Logging { ...@@ -892,12 +892,13 @@ object StreamingContext extends Logging {
} }
private[streaming] def rddToFileName[T](prefix: String, suffix: String, time: Time): String = { private[streaming] def rddToFileName[T](prefix: String, suffix: String, time: Time): String = {
if (prefix == null) { var result = time.milliseconds.toString
time.milliseconds.toString if (prefix != null && prefix.length > 0) {
} else if (suffix == null || suffix.length ==0) { result = s"$prefix-$result"
prefix + "-" + time.milliseconds }
} else { if (suffix != null && suffix.length > 0) {
prefix + "-" + time.milliseconds + "." + suffix result = s"$result.$suffix"
} }
result
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment