-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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-5984: Fix TimSort bug causes ArrayOutOfBoundsException #4804
Conversation
Can one of the admins verify this patch? |
@@ -65,6 +65,12 @@ class SorterSuite extends FunSuite { | |||
} | |||
} | |||
|
|||
test("bug of TimSort") { |
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.
would be good to provide a link to the original blog post
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.
and would be better to include the JIRA ticket number, i.e.
test("SPARK-5984 TimSort bug") {
...
}
Thanks for submitting the patch. I left some minor comments. |
* This codes generates a int array which fails the standard TimSort, Borrowed from | ||
* the reporter of this bug. | ||
* | ||
* http://www.envisage-project.eu/timsort-specification-and-verification/ |
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.
we should also link to the github repository with an explicit license https://github.com/abstools/java-timsort-bug
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 that's good practice. For completeness, because this AL2 and because there is no additional NOTICE file, we don't need to do anything else to our LICENSE or NOTICE file.
Jenkins, test this please. |
Test build #28105 has started for PR 4804 at commit
|
Test build #28105 has finished for PR 4804 at commit
|
Test FAILed. |
Ah. I guess I have to have license file header in .java, not just linked to it |
|
||
import java.util.*; | ||
|
||
/* |
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 need to put this in the beginning of the file, i.e. before the package definition
ok |
* https://github.com/abstools/java-timsort-bug | ||
* | ||
* Licensed under Apache License 2.0 | ||
* https://github.com/abstools/java-timsort-bug/blob/master/LICENSE |
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 this test code is your own work, then this statement is redundant with the license header, so would be removed.
But it's copied from the project above right? then you can't write a license header here that says it was licensed to the ASF. If anything we would reproduce the plain vanilla AL2 stanza from the plain AL2 license text up above in the file's license header.
That or not copy this test code. This Java code needs a bit more style work to match coding practices here.
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.
Well, it's not a exact copy, I made changes to the original codes.
Do you guys have a IntelliJ style that I can import ?
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.
It looks like it's almost entirely the code from the third party site. The right-est thing to do is actually begin this file with the standard AL2 stanza:
Copyright 2015 [the author's name]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
... since that is substantially the license of the work in the file. I believe the build's check for this stuff will accept this, or should. It can be followed with a comment that the work has been modified from its original form.
I don't think it's crazy to omit this either, though always nice to have tests.
THere's no standard IJ config but I'll point out some things that could be touched up.
@srowen I did what you recommended here. This passed the rat test on my machine at least |
OK, I apologize for belaboring this and hassle with the incorrect suggestion earlier. But I think we may have to do one more thing for the licensing to get it right, and we should. I believe we need an entry in our own |
@srowen Sounds good, done. |
Let's give @aarondav a chance to look at this also since he's the guy that introduced the timsort. |
LGTM as well. |
Thanks. I've merged this. |
Fix TimSort bug which causes a ArrayOutOfBoundsException. Using the proposed fix here http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/ Author: Evan Yu <ehotou@gmail.com> Closes #4804 from hotou/SPARK-5984 and squashes the following commits: 3421b6c [Evan Yu] SPARK-5984: Add info to LICENSE e61c6b8 [Evan Yu] SPARK-5984: Fix license and document 6ccc280 [Evan Yu] SPARK-5984: Add License header to file e06c0d2 [Evan Yu] SPARK-5984: Add License header to file 4d95f75 [Evan Yu] SPARK-5984: Fix TimSort bug causes ArrayOutOfBoundsException 479a106 [Evan Yu] SPARK-5984: Fix TimSort bug causes ArrayOutOfBoundsException (cherry picked from commit 643300a) Signed-off-by: Reynold Xin <rxin@databricks.com>
Thanks for the review guys |
Fix TimSort bug which causes a ArrayOutOfBoundsException.
Using the proposed fix here
http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/