I'm experiencing a UDF being invoked continuously when I call the filter method on a DataFrame and use the between method as a condition.
UDF
@udf(returnType=FloatType())
def test_udf(value):
calc = value * 2.00
return calc
Adding a new column to my DF:
df.withColumn("value_of_cash", test_udf(lit(2)))
Now filtering with between:
df = df.filter(
df.value_of_cash.between(0, df.spending_wise)
)
There isn't any error message, but I can see from logs that the UDF function gets invoked multiple times when using the between method call.