Calling a python function (def) in databricks

pjp94
Contributor

Not sure if I'm missing something here, but running a task outside of a python function runs much much quicker than executing the same task inside a function. Is there something I'm missing with how spark handles functions?

1)

def task(x):

y = dostuff(x)

return y

2)

y = dostuff(x)