Skip to content
Closed
Show file tree
Hide file tree
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
rename
  • Loading branch information
gatorsmile committed Jan 2, 2018
commit e8d0a4c7c8c9e81fd420195d3cc1a37a3b8459a3
2 changes: 1 addition & 1 deletion python/pyspark/sql/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ 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)
udf = f._set_name_type(name, returnType)
else:
udf = UserDefinedFunction(f, returnType=returnType, name=name,
evalType=PythonEvalType.SQL_BATCHED_UDF)
Expand Down
4 changes: 2 additions & 2 deletions python/pyspark/sql/udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __call__(self, *cols):
sc = SparkContext._active_spark_context
return Column(judf.apply(_to_seq(sc, cols, _to_java_column)))

def _set_name(self, name, returnType=StringType()):
def _set_name_type(self, name, returnType=StringType()):
"""
Updates the name of UserDefinedFunction.
"""
Expand Down Expand Up @@ -179,7 +179,7 @@ def wrapper(*args):
wrapper._judf = self._judf
wrapper._create_judf = self._create_judf
wrapper._wrapped = self._wrapped
wrapper._set_name = self._set_name
wrapper._set_name_type = self._set_name_type

return wrapper

Expand Down