<?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 Fuzzy Match on PySpark using UDF/Pandas UDF in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/fuzzy-match-on-pyspark-using-udf-pandas-udf/m-p/49500#M1606</link>
    <description>&lt;P&gt;I'm trying to do fuzzy matching on two dataframes by cross joining them and then using a udf for my fuzzy matching. But using both python udf and pandas udf its either very slow or I get an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/54169"&gt;@pandas&lt;/a&gt;_udf&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"int"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt;&lt;SPAN&gt; core_match_processor(s1: pd.Series, s2: pd.Series) -&amp;gt; pd.Series:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; pd.Series(&lt;/SPAN&gt;&lt;SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN&gt;(rapidfuzz.ratio(s1, s2)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;MatchUDF = f.pandas_udf(core_match_processor, returnType=IntegerType())&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df0 = df1.crossJoin(broadcast(df2))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df = df0.withColumn(&lt;/SPAN&gt;&lt;SPAN&gt;"Score"&lt;/SPAN&gt;&lt;SPAN&gt;, MatchUDF(f.col(&lt;/SPAN&gt;&lt;SPAN&gt;"String1"&lt;/SPAN&gt;&lt;SPAN&gt;), f.col(&lt;/SPAN&gt;&lt;SPAN&gt;"String2"&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Error:&amp;nbsp;org.apache.spark.SparkRuntimeException: [UDF_USER_CODE_ERROR.GENERIC] Execution of function core_match_processor&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 18 Oct 2023 22:20:49 GMT</pubDate>
    <dc:creator>mohaimen_syed</dc:creator>
    <dc:date>2023-10-18T22:20:49Z</dc:date>
    <item>
      <title>Fuzzy Match on PySpark using UDF/Pandas UDF</title>
      <link>https://community.databricks.com/t5/get-started-discussions/fuzzy-match-on-pyspark-using-udf-pandas-udf/m-p/49500#M1606</link>
      <description>&lt;P&gt;I'm trying to do fuzzy matching on two dataframes by cross joining them and then using a udf for my fuzzy matching. But using both python udf and pandas udf its either very slow or I get an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/54169"&gt;@pandas&lt;/a&gt;_udf&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"int"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;def&lt;/SPAN&gt;&lt;SPAN&gt; core_match_processor(s1: pd.Series, s2: pd.Series) -&amp;gt; pd.Series:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt; pd.Series(&lt;/SPAN&gt;&lt;SPAN&gt;int&lt;/SPAN&gt;&lt;SPAN&gt;(rapidfuzz.ratio(s1, s2)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;MatchUDF = f.pandas_udf(core_match_processor, returnType=IntegerType())&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df0 = df1.crossJoin(broadcast(df2))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;df = df0.withColumn(&lt;/SPAN&gt;&lt;SPAN&gt;"Score"&lt;/SPAN&gt;&lt;SPAN&gt;, MatchUDF(f.col(&lt;/SPAN&gt;&lt;SPAN&gt;"String1"&lt;/SPAN&gt;&lt;SPAN&gt;), f.col(&lt;/SPAN&gt;&lt;SPAN&gt;"String2"&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Error:&amp;nbsp;org.apache.spark.SparkRuntimeException: [UDF_USER_CODE_ERROR.GENERIC] Execution of function core_match_processor&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 18 Oct 2023 22:20:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/fuzzy-match-on-pyspark-using-udf-pandas-udf/m-p/49500#M1606</guid>
      <dc:creator>mohaimen_syed</dc:creator>
      <dc:date>2023-10-18T22:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy Match on PySpark using UDF/Pandas UDF</title>
      <link>https://community.databricks.com/t5/get-started-discussions/fuzzy-match-on-pyspark-using-udf-pandas-udf/m-p/49552#M1611</link>
      <description>&lt;P&gt;I'm now getting the error:&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class=""&gt;(SQL_GROUPED_AGG_PANDAS_UDF) is not supported on clusters in Shared access mode.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;Even though this article clearly states that pandas udf is supported for shared cluster in databricks&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.databricks.com/blog/shared-clusters-unity-catalog-win-introducing-cluster-libraries-python-udfs-scala-machine" target="_blank" rel="noopener"&gt;https://www.databricks.com/blog/shared-clusters-unity-catalog-win-introducing-cluster-libraries-python-udfs-scala-machine&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 22:28:14 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/fuzzy-match-on-pyspark-using-udf-pandas-udf/m-p/49552#M1611</guid>
      <dc:creator>mohaimen_syed</dc:creator>
      <dc:date>2023-10-19T22:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy Match on PySpark using UDF/Pandas UDF</title>
      <link>https://community.databricks.com/t5/get-started-discussions/fuzzy-match-on-pyspark-using-udf-pandas-udf/m-p/49631#M1622</link>
      <description>&lt;P&gt;Cluster:&lt;BR /&gt;Policy: Shared Compute&lt;/P&gt;&lt;P&gt;Access: Shared&lt;/P&gt;&lt;P&gt;Runtime:&amp;nbsp;&lt;SPAN&gt;14.1 (includes Apache Spark 3.5.0, Scala 2.12)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Worker type: Standard_L8s_v3 (64 GB Memory, 8 Cores) - workers- 1-60&lt;BR /&gt;Driver type: Standard_L8s_v3&amp;nbsp;(64 GB Memory, 8 Cores)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I added this&amp;nbsp;&lt;/SPAN&gt;line in my python notebook:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;spark.conf.&lt;/SPAN&gt;&lt;SPAN&gt;set&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;"spark.sql.execution.arrow.pyspark.enabled"&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"true"&lt;/SPAN&gt;&lt;SPAN&gt;) which I&amp;nbsp;&lt;/SPAN&gt;believe will enable&amp;nbsp;&lt;SPAN&gt;Apache &lt;/SPAN&gt;&lt;SPAN&gt;Apache Arrow optimization.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 20 Oct 2023 18:13:03 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/fuzzy-match-on-pyspark-using-udf-pandas-udf/m-p/49631#M1622</guid>
      <dc:creator>mohaimen_syed</dc:creator>
      <dc:date>2023-10-20T18:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy Match on PySpark using UDF/Pandas UDF</title>
      <link>https://community.databricks.com/t5/get-started-discussions/fuzzy-match-on-pyspark-using-udf-pandas-udf/m-p/64620#M2850</link>
      <description>&lt;P&gt;Any updates here? I'm running into the same problem with serverless compute&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 10:52:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/fuzzy-match-on-pyspark-using-udf-pandas-udf/m-p/64620#M2850</guid>
      <dc:creator>thibault</dc:creator>
      <dc:date>2024-03-26T10:52:31Z</dc:date>
    </item>
  </channel>
</rss>

