[
https://issues.apache.org/jira/browse/SPARK-10173?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14708320#comment-14708320
]
SonixLegend commented on SPARK-10173:
-------------------------------------
This is my test code.
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-repl_2.11</artifactId>
<version>1.4.1</version>
</dependency>
</dependencies>
SparkILoop iloop = new SparkILoop();
Settings settings = new Settings();
BooleanSetting setting = (BooleanSetting) settings.usejavacp();
setting.v_$eq(true);
iloop.settings_$eq(settings);
iloop.createInterpreter();
SparkIMain imain = iloop.intp();
try {
imain.interpret("@transient var map = new
java.util.HashMap[String, Object]()");
Map<String, Object> map = (Map<String, Object>)
imain.eval("map"); //imain.valueOfTerm("map");
map.put("Test", "测试");
imain.interpret("@transient val string =
map.get(\"Test\").asInstanceOf[String]");
imain.interpret("println(string)");
} catch (ScriptException e) {
e.printStackTrace();
}
> valueOfTerm get none when SparkIMain used on Java
> --------------------------------------------------
>
> Key: SPARK-10173
> URL: https://issues.apache.org/jira/browse/SPARK-10173
> Project: Spark
> Issue Type: Bug
> Components: Spark Shell
> Affects Versions: 1.4.1
> Environment: Spark 1.4.1 Scala 2.11 Java 1.7.0_21 Windows 8
> Reporter: SonixLegend
> Fix For: 1.4.2
>
>
> When I use Spark Repl on my Java project, I found if I had used the class
> SparkIMain via Scala 2.10 then the function valueOfTerm could get the term
> value, but if I had used same class via Scala 2.11, the valueOfTerm gave me a
> "none" result, and I checked the source code, found the line
> "sym.owner.companionSymbol" got none. Can you fix it? I used a alternative
> method, change valueOfTerm to eval, then it will get current result.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]