-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-8607] SparkR -- jars not being added to application classpath correctly #7001
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
+85
−1
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7c6bd0c
[SPARK-8607] SparkR
5a80844
Fix style nits
9101223
Merge branch 'branch-1.4' of github.com:apache/spark into branch-1.4
9a5c362
test for including JAR when launching sparkContext
ee25e60
Merge branch 'branch-1.4' of github.com:apache/spark into branch-1.4
0bea809
Fixed relative path issue and added smaller JAR
2c22073
Merge branch 'branch-1.4' of github.com:apache/spark into branch-1.4
31aedcf
Refactor test to call an external R script
8f81194
Add missing license
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,6 +88,19 @@ private[r] class RBackendHandler(server: RBackend) | |
| ctx.close() | ||
| } | ||
|
|
||
| //get classPath for static object. This addresses SPARK-5185 | ||
| def getStaticClass(objId: String): Class[_] = { | ||
| try { | ||
| val clsCurrent = Class.forName(objId) | ||
| clsCurrent | ||
| } catch { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align |
||
| //use contextLoader if we can't find the JAR in the system class loader | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same style nit space after |
||
| case e: ClassNotFoundException => | ||
| val clsContext = Class.forName(objId, true, Thread.currentThread().getContextClassLoader) | ||
| clsContext | ||
| } | ||
| } | ||
|
|
||
| def handleMethodCall( | ||
| isStatic: Boolean, | ||
| objId: String, | ||
|
|
@@ -98,7 +111,7 @@ private[r] class RBackendHandler(server: RBackend) | |
| var obj: Object = null | ||
| try { | ||
| val cls = if (isStatic) { | ||
| Class.forName(objId) | ||
| getStaticClass(objId) | ||
| } else { | ||
| JVMObjectTracker.get(objId) match { | ||
| case None => throw new IllegalArgumentException("Object not found " + objId) | ||
|
|
||
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.
Style nit: Space after
//- Also could you expand the comment to sayLooks up a class given a class name. This function first checks the current class loader and if a class is not found, it looks up the class in the context class loader.