Skip to content

Commit 72a5ec0

Browse files
author
Davies Liu
committed
avoid unnecessary conversion
1 parent 8597bba commit 72a5ec0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

python/pyspark/worker.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,11 @@ def chain(f, g):
6363

6464

6565
def wrap_udf(f, return_type):
66-
toInternal = return_type.toInternal
67-
return lambda *a: toInternal(f(*a))
66+
if return_type.needConversion():
67+
toInternal = return_type.toInternal
68+
return lambda *a: toInternal(f(*a))
69+
else:
70+
return lambda *a: f(*a)
6871

6972

7073
def read_single_udf(pickleSer, infile):

0 commit comments

Comments
 (0)