Snowpark UDF issue

Registered Posts: 7 ✭✭✭
edited November 2024 in Using Dataiku

Below is a code for calling a snowpark UDF in python recipe. The environment is connected to snowflake.

def ABC(session,
        df):
  def BCD_UDF(X,Y,Z):
    pandas series processing
    return pd.DataFrame(…)
# Register the function as a UDF
BCD = session.udf.register(
func = BCD_UDF,
return_type=StructType([
StructField("MN", StringType())
]),
input_types=[FloatType(),
FloatType(),
DateType()
],
is_permanent=False,
name = "BCD",
session=session
)
df_final = df.with_column(
"data",
BCD(
F.col("X"),
F.col("Y"),
F.col("X")
)
)

I am reading inputs as snowpark dataframe but in BCD udf, I am using pandas series. However I continue to get error - 'Unknown function BCD_UDF". How can I fix this?
Please help

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.