Skip to content

Commit

Permalink
#223 Changes in PY4J 0.10.4 caused the error. Fix is to not set None …
Browse files Browse the repository at this point in the history
…value in py4j array
  • Loading branch information
David Taieb committed Jul 27, 2017
1 parent 5610889 commit 9b57e1d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pixiedust/display/templates/executePythonDisplayMacro.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function() {
output:function(msg){
console.log("msg", msg);
if ({{"false" if "cell_id" in this.options else "true"}}){
curCell.output_area.clear_output(false, true);
//curCell.output_area.clear_output(false, true);
curCell.output_area.handle_output.apply(curCell.output_area, arguments);
return;
}
Expand Down
6 changes: 4 additions & 2 deletions pixiedust/utils/javaBridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ def callMethod(self, methodName, *args):
jMethodParams = None if argLen == 0 else sc._gateway.new_array(sc._jvm.Class, argLen )
jMethodArgs = None if argLen == 0 else sc._gateway.new_array(sc._jvm.Object, argLen )
for i,arg in enumerate(args):
jMethodParams[i] = None if arg is None else (arg if arg.__class__.__name__ == "JavaClass" else arg.getClass())
jMethodArgs[i] = arg
if arg is not None:
jMethodParams[i] = arg if arg.__class__.__name__ == "JavaClass" else arg.getClass()
jMethodArgs[i] = arg
myLogger.debug("Arg for {} is {}".format( i, arg))
#find the method and invoke it
for m in self.jHandle.getClass().getMethods():
if m.getName() == methodName and len(m.getParameterTypes()) == argLen:
Expand Down
6 changes: 5 additions & 1 deletion pixiedust/utils/scalaBridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,11 @@ def scala(self, line, cell):

runnerObject = JavaWrapper(cls.getField("MODULE$").get(None), True,
self.getLineOption(line, "channel"), self.getLineOption(line, "receiver"))
runnerObject.callMethod("init", pd_getJavaSparkContext(), None if self.hasLineOption(line, "noSqlContext") else self.interactiveVariables.getVar("sqlContext")._ssql_ctx )
safeAccess = lambda obj, fieldName: None if obj is None or not hasattr(obj, fieldName) else getattr(obj, fieldName)
runnerObject.callMethod("init",
pd_getJavaSparkContext(),
None if self.hasLineOption(line, "noSqlContext") else safeAccess(self.interactiveVariables.getVar("sqlContext"), "_ssql_ctx" )
)

#Init the variables
for key, val in iteritems(self.interactiveVariables.getVarsDict()):
Expand Down

0 comments on commit 9b57e1d

Please sign in to comment.