Survey banner
Switching to Dataiku - a new area to help users who are transitioning from other tools and diving into Dataiku! CHECK IT OUT

UDFs in SparkSQL

Level 1
UDFs in SparkSQL

Is it possible to use UDFs within a SparkSQL recipe? If so how do I define it.

This is the function I am trying to use'

def CAPITALIZE(str_wrd):
    if str_wrd and not str_wrd.isspace() and isinstance(str_wrd,str😞
        final_wrd = []
        new_str= str_wrd.lower().split()
        for x in new_str:
            if x:
                x1 = x.capitalize()
        result = " ".join(final_wrd)
        result = None       
    return result

spark.udf.register("CAPITALIZE", CAPITALIZE)
0 Kudos
0 Replies