-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-18420][BUILD] Fix the errors caused by lint check in Java #15865
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
|
Hi @ConeyLiu, It seems is missed. If it is a required change, I guess we should disable the lint check for the lines. |
|
@HyukjinKwon I'm sorry for that, I've fixed it, please take a look. Thanks a lot. |
|
They're caused by lint right? not checkstyle? and these are only Java, because that's all that's not automatically tested. Please update the title/description with more meaningful details, including the JIRA. |
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.
Why was this removed? it needs to be here for sure
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.
You made this non-static; that's not a style issue right? it may be OK but some of these changes don't seem to match the description
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.
@srowen I've updated, but It seems the hasher never used.
|
@srowen Thanks for the review, I've updated it. |
|
@ConeyLiu Let us please change the title to something like Also, I think for the one below: we should disable the lint for the lines because it seems a required one. I guess you should disable the check for the lines or work around this. Could we then remove Also, I have a link I usually refer, https://cwiki.apache.org/confluence/display/SPARK/Contributing+to+Spark Maybe, this pull request and JIRA can be nicer if both follow the guild lines. |
|
@HyukjinKwon Thanks for the review and suggestion, I've updated it. Clear the unused object |
dev/checkstyle-suppressions.xml
Outdated
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.
Ah, I thought we could disable it only for some lines like Scala/Python/R. I am fine with this if it is only the way.
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.
@HyukjinKwon Also we could try // style:off ... // style:on. I'll test this way.
|
Test build #3425 has finished for PR 15865 at commit
|
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.
Hi @ConeyLiu, it is a super minor but it seems we should make the indentation for this (and the same instances here) double-spaced. I at least could find some examples for this such as in UnsafeMemoryAllocator
assert (memory.obj == null) :
"baseObject not null; are you trying to use the off-heap allocator to free on-heap memory?";or in ShuffleSortDataFormat
assert (length <= buffer.size()) :
"the buffer is smaller than required: " + buffer.size() + " < " + length;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 you are supposed to push more commits, let us revert this extra newline removal. I guess some guys don't like such changes. At least I was told twice before.
|
For sure, I ran $ ./dev/lint-java
Using `mvn` from path: .../mvn
Checkstyle checks passed.It seems fine. It looks good to me for few minor comments above. |
|
@HyukjinKwon I'm sorry for so late reply. I update the code and style followed by your suggestion, that's so useful. And also I change the method of disabling the check around |
| <property name="onCommentFormat" value="checkstyle.on\: ([\w\|]+)"/> | ||
| <property name="checkFormat" value="$1"/> | ||
| </module> | ||
|
|
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.
Ah, I am sorry @ConeyLiu. I should have taken a look ahead first. I actually rather meant agreeing with the previous state if we should introduce such new property... Although I (as just one of contributors) think this might be worth, maybe this should be handled in a different PR.
Maybe, I think we could keep this change and then propose a new separate PR later if other people also agree with this.
Let us maybe please revert this change back and move back to the state which Sean approved for sure (but including the indentation fixes and newline fix). I will try to run the lint for sure as soon as you do.
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.
Ok, maybe we need more advices.
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.
Ah OK, this is needed in order to implement a checkstyle:off for Java like we use scalastyle:off for Scala? that's fine to do here if so, because it seems like we need it to get past the finalizer issue. I think that's a fine general mechanism to enable.
|
@srowen hi owen, Can you give me some advice, and if so, what a great thing. |
| <module name="UnusedImports"/> | ||
| <module name="RedundantImport"/> | ||
| <module name="RedundantModifier"/> | ||
| <module name="FileContentsHolder"/> |
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.
What is this needed for, the checkstyle:off mechanism?
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.
@srowen SuppressionCommentFilterand FileContentsHolder must work together,http://stackoverflow.com/questions/5761188/checkstyle-suppressioncommentfilter-not-ignoring-specified-rule
|
I just checked for sure. |
|
@HyukjinKwon @srowen Thank you very much. |
Small fix, fix the errors caused by lint check in Java - Clear unused objects and `UnusedImports`. - Add comments around the method `finalize` of `NioBufferedFileInputStream`to turn off checkstyle. - Cut the line which is longer than 100 characters into two lines. Travis CI. ``` $ build/mvn -T 4 -q -DskipTests -Pyarn -Phadoop-2.3 -Pkinesis-asl -Phive -Phive-thriftserver install $ dev/lint-java ``` Before: ``` Checkstyle checks failed at following occurrences: [ERROR] src/main/java/org/apache/spark/network/util/TransportConf.java:[21,8] (imports) UnusedImports: Unused import - org.apache.commons.crypto.cipher.CryptoCipherFactory. [ERROR] src/test/java/org/apache/spark/network/sasl/SparkSaslSuite.java:[516,5] (modifier) RedundantModifier: Redundant 'public' modifier. [ERROR] src/main/java/org/apache/spark/io/NioBufferedFileInputStream.java:[133] (coding) NoFinalizer: Avoid using finalizer method. [ERROR] src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeMapData.java:[71] (sizes) LineLength: Line is longer than 100 characters (found 113). [ERROR] src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeArrayData.java:[112] (sizes) LineLength: Line is longer than 100 characters (found 110). [ERROR] src/test/java/org/apache/spark/sql/catalyst/expressions/HiveHasherSuite.java:[31,17] (modifier) ModifierOrder: 'static' modifier out of order with the JLS suggestions. [ERROR]src/main/java/org/apache/spark/examples/ml/JavaLogisticRegressionWithElasticNetExample.java:[64] (sizes) LineLength: Line is longer than 100 characters (found 103). [ERROR] src/main/java/org/apache/spark/examples/ml/JavaInteractionExample.java:[22,8] (imports) UnusedImports: Unused import - org.apache.spark.ml.linalg.Vectors. [ERROR] src/main/java/org/apache/spark/examples/ml/JavaInteractionExample.java:[51] (regexp) RegexpSingleline: No trailing whitespace allowed. ``` After: ``` $ build/mvn -T 4 -q -DskipTests -Pyarn -Phadoop-2.3 -Pkinesis-asl -Phive -Phive-thriftserver install $ dev/lint-java Using `mvn` from path: /home/travis/build/ConeyLiu/spark/build/apache-maven-3.3.9/bin/mvn Checkstyle checks passed. ``` Author: Xianyang Liu <[email protected]> Closes #15865 from ConeyLiu/master. (cherry picked from commit 7569cf6) Signed-off-by: Sean Owen <[email protected]>
|
Merged to master/2.1 |
## What changes were proposed in this pull request? Small fix, fix the errors caused by lint check in Java - Clear unused objects and `UnusedImports`. - Add comments around the method `finalize` of `NioBufferedFileInputStream`to turn off checkstyle. - Cut the line which is longer than 100 characters into two lines. ## How was this patch tested? Travis CI. ``` $ build/mvn -T 4 -q -DskipTests -Pyarn -Phadoop-2.3 -Pkinesis-asl -Phive -Phive-thriftserver install $ dev/lint-java ``` Before: ``` Checkstyle checks failed at following occurrences: [ERROR] src/main/java/org/apache/spark/network/util/TransportConf.java:[21,8] (imports) UnusedImports: Unused import - org.apache.commons.crypto.cipher.CryptoCipherFactory. [ERROR] src/test/java/org/apache/spark/network/sasl/SparkSaslSuite.java:[516,5] (modifier) RedundantModifier: Redundant 'public' modifier. [ERROR] src/main/java/org/apache/spark/io/NioBufferedFileInputStream.java:[133] (coding) NoFinalizer: Avoid using finalizer method. [ERROR] src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeMapData.java:[71] (sizes) LineLength: Line is longer than 100 characters (found 113). [ERROR] src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeArrayData.java:[112] (sizes) LineLength: Line is longer than 100 characters (found 110). [ERROR] src/test/java/org/apache/spark/sql/catalyst/expressions/HiveHasherSuite.java:[31,17] (modifier) ModifierOrder: 'static' modifier out of order with the JLS suggestions. [ERROR]src/main/java/org/apache/spark/examples/ml/JavaLogisticRegressionWithElasticNetExample.java:[64] (sizes) LineLength: Line is longer than 100 characters (found 103). [ERROR] src/main/java/org/apache/spark/examples/ml/JavaInteractionExample.java:[22,8] (imports) UnusedImports: Unused import - org.apache.spark.ml.linalg.Vectors. [ERROR] src/main/java/org/apache/spark/examples/ml/JavaInteractionExample.java:[51] (regexp) RegexpSingleline: No trailing whitespace allowed. ``` After: ``` $ build/mvn -T 4 -q -DskipTests -Pyarn -Phadoop-2.3 -Pkinesis-asl -Phive -Phive-thriftserver install $ dev/lint-java Using `mvn` from path: /home/travis/build/ConeyLiu/spark/build/apache-maven-3.3.9/bin/mvn Checkstyle checks passed. ``` Author: Xianyang Liu <[email protected]> Closes apache#15865 from ConeyLiu/master.
What changes were proposed in this pull request?
Small fix, fix the errors caused by lint check in Java
UnusedImports.finalizeofNioBufferedFileInputStreamto turn off checkstyle.How was this patch tested?
Travis CI.
Before:
After: