-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
[SPARK-13692][CORE][SQL] Fix trivial Coverity/Checkstyle defects #11530
Conversation
Hi, @srowen . |
@@ -44,8 +44,9 @@ public static void main(String[] args) { | |||
public Vector call(String s) { | |||
String[] sarray = s.trim().split(" "); | |||
double[] values = new double[sarray.length]; | |||
for (int i = 0; i < sarray.length; i++) | |||
for (int i = 0; i < sarray.length; i++) { |
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.
This is fine, but it wasn't the analysis problem. A lot of the examples don't stop()
the context at the end, and this was one of about 30.
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.
Oh, I fix this since it's the error from one 'Checkstyle' (lint-java).
Up to now, this PR does not include stop()
context discussed in emails.
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 see. That's important then.
It's looking fine; do you want to address some more of the simple ones? like identical branches of an if, unused fields, etc? |
Jenkins test this please |
Thank you, @srowen . |
Test build #52513 has finished for PR 11530 at commit
|
Hi, @srowen . I did the followings, too.
Could you merge this if the test passes again? |
retest this please |
2 similar comments
retest this please |
retest this please |
Hi, @srowen . |
@@ -390,6 +390,7 @@ public void testQueueStream() { | |||
JavaTestUtils.attachTestOutputStream(stream); | |||
List<List<Integer>> result = JavaTestUtils.runStreams(ssc, 3, 3); | |||
Assert.assertEquals(expected, result); | |||
jsc.close(); |
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.
These types of changes are welcome of course but I think we need to call stop()
in the examples, not close()
. Or at least that's what the others do. I don't think Coverity will realize that, but that's fine, it's then a false positive we just resolve as such.
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.
Oh, thank you for pointing that. I will replace them all with stop
.
Hi, @srowen . |
Jenkins, test this please |
Test build #52553 has finished for PR 11530 at commit
|
Oh, @srowen .
It seems really timeout for the whole test.
Do you think we put too much thing in one PR? |
Just rebased. |
Thanks to #11564 , I can fix |
retest this please |
ok to test |
Thank you, @zsxwing ! |
Test build #52611 has finished for PR 11530 at commit
|
retest this please |
Test build #52631 has finished for PR 11530 at commit
|
Thank you, @zsxwing . |
Hi, @srowen . |
@@ -171,5 +171,6 @@ public void call(JavaPairRDD<Double, String> happinessTopicPairs) { | |||
|
|||
jssc.start(); | |||
jssc.awaitTermination(); | |||
jssc.close(); |
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 just realized I misled you in my comments. For streaming examples, we should not call close()
or stop()
. The correct last call is awaitTermination()
. If you back those out, I'll merge this. Sorry about that.
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.
Oh, it's my fault. I'll fix right now. Thank you again.
* Implement both null and type checking in equals functions. * Fix wrong type casting logic in SimpleJavaBean2.equals. * Add `implement Cloneable` to `UTF8String` and `SortedIterator`. * Remove dereferencing before null check in `AbstractBytesToBytesMapSuite`. * Fix coding style: Add '{}' to single `for` statement in mllib examples. * Remove unused imports in `ColumnarBatch`.
Hi, @srowen . I've finished. |
Test build #52662 has finished for PR 11530 at commit
|
Test build #52663 has finished for PR 11530 at commit
|
Hi, @srowen . |
Merged to master |
Thank you, @srowen ! |
## What changes were proposed in this pull request? This issue fixes the following potential bugs and Java coding style detected by Coverity and Checkstyle. - Implement both null and type checking in equals functions. - Fix wrong type casting logic in SimpleJavaBean2.equals. - Add `implement Cloneable` to `UTF8String` and `SortedIterator`. - Remove dereferencing before null check in `AbstractBytesToBytesMapSuite`. - Fix coding style: Add '{}' to single `for` statement in mllib examples. - Remove unused imports in `ColumnarBatch` and `JavaKinesisStreamSuite`. - Remove unused fields in `ChunkFetchIntegrationSuite`. - Add `stop()` to prevent resource leak. Please note that the last two checkstyle errors exist on newly added commits after [SPARK-13583](https://issues.apache.org/jira/browse/SPARK-13583). ## How was this patch tested? manual via `./dev/lint-java` and Coverity site. Author: Dongjoon Hyun <dongjoon@apache.org> Closes apache#11530 from dongjoon-hyun/SPARK-13692.
What changes were proposed in this pull request?
This issue fixes the following potential bugs and Java coding style detected by Coverity and Checkstyle.
implement Cloneable
toUTF8String
andSortedIterator
.AbstractBytesToBytesMapSuite
.for
statement in mllib examples.ColumnarBatch
andJavaKinesisStreamSuite
.ChunkFetchIntegrationSuite
.stop()
to prevent resource leak.Please note that the last two checkstyle errors exist on newly added commits after SPARK-13583.
How was this patch tested?
manual via
./dev/lint-java
and Coverity site.