-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-12530][Build] Fix build break at Spark-Master-Maven-Snapshots from #1293 #10488
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
use raw string literal to avoid string concatenations
|
Test build #48348 has finished for PR 10488 at commit
|
|
Thanks for letting me know them. I will check them. |
|
@hvanhovell, a set of following two conditions causes this compilation failure:
I can reproduce this compilation error by using the following command: |
switch some usage in ExpressionDescription to raw string literal
|
More people are having this problem. Lets use raw strings then. |
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.
Nit style. I guess this was needed to stay within 100 charaters?
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.
Yes, this keeps within 100 characters at a line.
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.
Style below make newline display more reasonable.
s"""first line
| second line
""".stripMarginThere 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.
Does that work under 2.11?
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 have just tried this; it doesn't work unfortunately.
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.
@yhuai , the above line did not cause the same issue. This is because its length is less than 100 and it has only one concatenation.
I checked by inserting // scalastyle:off before the annotation and // scalastyle:on after the annotation as follows:
// scalastyle:off
@ExpressionDescription(
usage = "_FUNC_(input, bitLength) - Returns a checksum of SHA-2 family as a hex string of the " +
"input. SHA-224, SHA-256, SHA-384, and SHA-512 are supported. Bit length of 0 is equivalent to 256",
extended = "> SELECT _FUNC_('Spark', 0);\n " +
"'529bc3b07127ecb7e53a4dcf1991d9152c24537d919178022b2c42657f79a26b'")
// scalastyle:on
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.
@kiszk I see. How about we remove concatenation from both usage and extended? We can just use multi-line string.
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.
If we use the multi-line string, we need to be careful when adding \n. This does not work. I already hit this issue when I do the fix in another related PR: #10418
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.
@yhuai, it sounds good to use multi-line string for usage and extended. How about this policy?
- First, we use raw string literal to remove concatenations.
- If we still want to use a line with more than 100 characters,
// scalastyle:offand// scalastyle:oncan be used.
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.
In another way, I am trying to reproduce this compilation error in a standalone test case. However, I cannot reproduce this failure (i.e. compilations are successfully finished).
$ cat ExpressionDescription.java
import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME)
public @interface ExpressionDescription {
String usage() default "_FUNC_ is undocumented";
String extended() default "No example for _FUNC_.";
}
$ cat test.scala
@ExpressionDescription(
usage = "_FUNC_(input, bitLength) - Returns a checksum of SHA-2 family as a hex string of the " +
"input. SHA-224, SHA-256, SHA-384, and SHA-512 are supported. Bit length of 0 is equivalent " +
"to 256",
extended = "> SELECT _FUNC_('Spark', 0);\n " +
"'529bc3b07127ecb7e53a4dcf1991d9152c24537d919178022b2c42657f79a26b'")
class test {
def func() : Unit = {
val str = "abc" + "123" + "XYZ"
}
}
$ javac ExpressionDescription.java
$ ~/scala-2.11.7/bin/scalac test.scala
$
|
@yhuai can you take a look at this? |
switch some usage in ExpressionDescription to raw string literal
|
@kiszk Thank you for the investigation. Yeah, let's use multi-line string literals. If we have to have a line with more than 100 characters, let's use |
|
Can you update the pr? Once it passes jenkins, I will merge it. Thanks! |
|
@yhuai, do you mean that I would update all of the string concatenation in @ExpressionDescription by using multi-line string literals rather than only the original one? |
|
Let me merge this one first to fix the spark master maven snapshot. Then, can you create another jira to update other places? |
|
I see. I will create another JIRA entry to update other usages. |
…ed in @ExpressionDescription Use multi-line string literals for ExpressionDescription with ``// scalastyle:off line.size.limit`` and ``// scalastyle:on line.size.limit`` The policy is here, as describe at #10488 Let's use multi-line string literals. If we have to have a line with more than 100 characters, let's use ``// scalastyle:off line.size.limit`` and ``// scalastyle:on line.size.limit`` to just bypass the line number requirement. Author: Kazuaki Ishizaki <[email protected]> Closes #10524 from kiszk/SPARK-12580.
Compilation error caused due to string concatenations that are not a constant
Use raw string literal to avoid string concatenations
https://amplab.cs.berkeley.edu/jenkins/view/Spark-Packaging/job/Spark-Master-Maven-Snapshots/1293/