-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-13640][SQL] Synchronize ScalaReflection.mirror method. #11487
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b9d99bd
Add a test to check thread safety of ScalaRefection.mirror method.
ueshin 389d644
Synchronize ScalaReflection.mirror method.
ueshin 549b8f8
Modify test to check other methods using reflection.
ueshin cee5896
Synchronize ScalaReflection.localTypeOf method.
ueshin 36cfa08
Add comments.
ueshin 0055fd1
Modify test.
ueshin 7ac9648
Merge branch 'master' into issues/SPARK-13640
ueshin 63b1797
Re-modify test.
ueshin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
(0 until 100).foreach? probably just a matter of taste but it's symmetrical with your inner loop then.You can import
java.net.URLClassLoader.It doesn't really seem like you need a method here; it took a moment to see there was a test in here.
Maybe it's obvious to you but why do all these classes/methods need to be tested separately?
And is this locking still safe in 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.
@srowen Thank you for your comment.
I repeated the test 100 times here because it is for thread-safety. Thread safety problem sometimes happens but sometimes doesn't.
I'll modify to use import.
I'll modify to move out of the method.
The methods are public, i.e. can be called by multi-thread, so I thought these also need to be tested.
But I'm wondering some of them could be removed?
Yes, reflection in Scala 2.11 is thread-safe.
If we don't support Scala 2.10, these lockings in
ScalaReflectionwould not be needed.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 I understand repeating it 100 times, but your idiom for iterating n times is different on two nearby lines.
I actually meant the opposite -- remove the helper method but run
tests in a loop still -- but leave it.My question was more like, does the extra locking cause trouble in 2.11? I know you said 2.11 doesn't need this change per se.