Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
clean
  • Loading branch information
gatorsmile committed Jan 2, 2018
commit 0ecdf63e8d8178528c46254859c4c0c10b80ba08
6 changes: 2 additions & 4 deletions python/pyspark/sql/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,11 @@ def registerFunction(self, name, f, returnType=StringType()):

if hasattr(f, 'asNondeterministic'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this one made me to suggest wrapper._unwrapped = lambda: self way.

So, here this can be wrapped function or UserDefinedFunction and I thought it's not quite clear what we expect here by hasattr(f, 'asNondeterministic').

Could we at least leave come comments saying that this can be both wrapped function for UserDefinedFunction and UserDefinedFunction itself?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add a comment.

udf = f._set_name(name, returnType)
self._jsparkSession.udf().registerPython(name, udf._judf)
return udf._wrapped()
else:
udf = UserDefinedFunction(f, returnType=returnType, name=name,
evalType=PythonEvalType.SQL_BATCHED_UDF)
self._jsparkSession.udf().registerPython(name, udf._judf)
return udf._wrapped()
self._jsparkSession.udf().registerPython(name, udf._judf)
return udf._wrapped()

@since(2.0)
def isCached(self, tableName):
Expand Down