cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

[UDF_MAX_COUNT_EXCEEDED] Exceeded query-wide UDF limit of 5 UDFs

marianopenn
New Contributor III

We are using DLT to ingest data into our Unity catalog and then, in a separate job, we are reading and manipulating this data and then writing it to a table like:

df.write.saveAsTable(name=target_table_path)


We are getting an error which I cannot find ANY documentation about:

SparkRuntimeException: [UDF_MAX_COUNT_EXCEEDED] Exceeded query-wide UDF limit of 5 UDFs (limited during public preview). Found 14. 

What does this mean and how can we address it?
Running on an i3.xlarge shared cluster, DBR 13.2, Spark 3.4.0, Scala 2.12.

1 ACCEPTED SOLUTION

Accepted Solutions

Tharun-Kumar
Honored Contributor II

@marianopenn 

This limit was introduced as a mitigation to reduce the risk of OOM errors. On a shared cluster it's possible to override the limit by setting the spark.databricks.safespark.externalUDF.plan.limit spark config in the cluster UI.

Note that overriding this config might lead to OOM errors during query execution.

View solution in original post

6 REPLIES 6

Tharun-Kumar
Honored Contributor II

@marianopenn 

This limit was introduced as a mitigation to reduce the risk of OOM errors. On a shared cluster it's possible to override the limit by setting the spark.databricks.safespark.externalUDF.plan.limit spark config in the cluster UI.

Note that overriding this config might lead to OOM errors during query execution.

Anonymous
Not applicable

Hi @marianopenn 

We haven't heard from you since the last response from @Tharun-Kumar โ€‹, and I was checking back to see if her suggestions helped you.

Or else, If you have any solution, please share it with the community, as it can be helpful to others. 

Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

marianopenn
New Contributor III

Hi @Anonymous @Tharun-Kumar Yes, this spark setting removed the 5 UDF limit. We did encounter a memory issue, but we can work with that. If you could, please include this kind of limitation and the way to get around it somewhere in the Unity Catalog documentation. Thanks. 

AlexPrev
New Contributor II

Hi @marianopenn @Tharun-Kumar could you please provide further details as to how to set the parameter in the cluster UI? We're currently facing a very similar issue, but I'm not 100% sure where & how to set the spark.databricks.safespark.externalUDF.plan.limit

Perhaps could you attach a screenshot?

Thank you!

marianopenn
New Contributor III

It's set as a spark config on your cluster. Check out the Databricks docs on this topic here.

Tharun-Kumar
Honored Contributor II

@AlexPrev 

You can traverse to the Advanced Settings in the Cluster configuration and include this config in the Spark section.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group