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: 

How to unload a Jar for UDF without restart spark context?

vonjack
New Contributor II

In the scala notebook of databricks, I created a temporary function with a certain Jar and class name. 

Then I want to update the Jar. But without restart the context, I can not reload the new Jar, the temporary function always reuses the old classes.

I noticed that for normal function it support refresh, but temporary function doesn't.

Does anyone know the way to resolve this issue?

2 REPLIES 2

vonjack
New Contributor II

Hi, I tried updated Jar, drop and re-create the temporary function, the UDF still use the old Jar.

I don't want to restart context and cleanup workspace, are there any other better solutions?

vonjack
New Contributor II

So if I don't want to restart the cluster, do you think the versionized jar name and class name would be a better solution?

 

At first, I used this command to create the original UDF:

create or replace temporary function test_udf as 'com.example.TestUDF_v1' using jar '/tmp/test_udf_v1.jar';

 

Then I want to update the UDF, I'll try that: 

create or replace temporary function test_udf as 'com.example.TestUDF_v2' using jar '/tmp/test_udf_v2.jar';

But that may be into another problem, if different jars have the same class name like 'com.example.SameClass', which version of class will spark cluster use eventually without restart?

 

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