From what I have seen, in order to do this you have to
- make the
udfas a plain function register the function with
SQLContextfor SQLspark.sqlContext.udf.register("myUDF", myFunc)turn this into a
UserDefinedFunctionforDataFramedef myUDF = udf(myFunc)
Is there no way to combine this into one step and make the udf available for both? Also, for cases where a function exists for DataFrame but not for SQL, how do you go about registering it without copying over the code again?