<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create persistent Scala UDF in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/create-persistent-scala-udf/m-p/59715#M6474</link>
    <description>&lt;P&gt;I've created a UDF in Scala (using Databricks notebook) which checks if the value of a field in a table is greater than 0, then sum those values. UDF is working as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is, that this UDF will be used by multiple SQLs across different notebooks.&amp;nbsp; How can I make this UDF available to all the notebooks and avoid the re-creation of UDF&amp;nbsp; in each notebook?&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 16:34:25 GMT</pubDate>
    <dc:creator>amama</dc:creator>
    <dc:date>2024-02-08T16:34:25Z</dc:date>
    <item>
      <title>Create persistent Scala UDF</title>
      <link>https://community.databricks.com/t5/get-started-discussions/create-persistent-scala-udf/m-p/59715#M6474</link>
      <description>&lt;P&gt;I've created a UDF in Scala (using Databricks notebook) which checks if the value of a field in a table is greater than 0, then sum those values. UDF is working as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is, that this UDF will be used by multiple SQLs across different notebooks.&amp;nbsp; How can I make this UDF available to all the notebooks and avoid the re-creation of UDF&amp;nbsp; in each notebook?&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 16:34:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/create-persistent-scala-udf/m-p/59715#M6474</guid>
      <dc:creator>amama</dc:creator>
      <dc:date>2024-02-08T16:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: Create persistent Scala UDF</title>
      <link>https://community.databricks.com/t5/get-started-discussions/create-persistent-scala-udf/m-p/59737#M6475</link>
      <description>&lt;P&gt;In the child notebook:&lt;/P&gt;&lt;PRE&gt;def my_udf(x):
  return x + 1
&amp;nbsp;
spark.udf.register("my_udf", my_udf)
&amp;nbsp;
dbutils.notebook.exit(my_udf)&lt;/PRE&gt;&lt;P&gt;In the master notebook:&lt;/P&gt;&lt;PRE&gt;child_udf = dbutils.notebook.run("PathToChildnotebook", timeout_seconds=600)
spark.udf.register("my_udf", child_udf)&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://community.databricks.com/t5/data-engineering/master-notebook-cannot-find-the-udf-registered-in-the-child/td-p/6145" target="_blank" rel="noopener"&gt;Solved: master notebook cannot find the udf registered in ... - Databricks - 6145&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 03:31:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/create-persistent-scala-udf/m-p/59737#M6475</guid>
      <dc:creator>feiyun0112</dc:creator>
      <dc:date>2024-02-09T03:31:03Z</dc:date>
    </item>
  </channel>
</rss>

