-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-12136] [STREAMING] rddToFileName does not properly handle prefix and suffix parameters #10185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
result.toString() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine; it might be simpler without bothering with StringBuilder
but not by much.
(In your code you should use val result
and you do not need to assign result
each time.)
var result = time.milliseconds.toString
if (prefix != null && prefix.length > 0) {
result = prefix + "-" result
}
if (suffix != null && suffix.length > 0) {
result = result + "." + suffix
}
result
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code was changed according to your comments by using String instead.
Test build #2179 has finished for PR 10185 at commit
|
prefix + "-" + time.milliseconds + "." + suffix | ||
var result = time.milliseconds.toString | ||
if (prefix != null && prefix.length > 0) { | ||
result = prefix + "-" + result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets use string interpolation for this.
LGTM |
Test build #2189 has finished for PR 10185 at commit
|
…x 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 <[email protected]> Author: Bo Meng <[email protected]> Closes #10185 from bomeng/SPARK-12136. (cherry picked from commit e29704f) Signed-off-by: Sean Owen <[email protected]>
Merged to master/1.6 |
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.