Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on November 8, 2024 7:20PM
Likes: 0
Replies: 0
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