Github user BryanCutler commented on the issue:
https://github.com/apache/spark/pull/18659
The following was used to test performance locally
```python
spark = SparkSession.builder.appName("vectorized_udfs").getOrCreate()
vectorize = True
if vectorize:
from numpy import log, exp
spark.conf.set("spark.sql.execution.arrow.vectorizeUDFs", "true")
else:
from math import log, exp
spark.conf.set("spark.sql.execution.arrow.vectorizeUDFs", "false")
def my_func(p1, p2):
w = 0.5
return exp(log(p1) + log(p2) - log(w))
df = spark.range(1 << 24, numPartitions=16).toDF("id") \
.withColumn("p1", rand()).withColumn("p2", rand())
my_udf = udf(my_func, DoubleType())
df.withColumn("p", my_udf(col("p1"), col("p2")))
```
**Non-Vectorized** ~ 6.127449s
**Vectorized** ~ 2.867868s
Speedup of 2.14x
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]