<?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 Re: AnalysisException: [UC_COMMAND_NOT_SUPPORTED] Spark higher-order functions are not supported in in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/analysisexception-uc-command-not-supported-spark-higher-order/m-p/39569#M27017</link>
    <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/65069"&gt;@Mr_K&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ApplyInPandas is a higher order function in Python. As of now, we do not support higher order functions in Unity Catalog. We do support direct calls made to python UDFs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of how to reference UDFs in UC -&amp;nbsp;&lt;A href="https://docs.databricks.com/en/udf/python.html" target="_blank"&gt;https://docs.databricks.com/en/udf/python.html&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Aug 2023 04:54:22 GMT</pubDate>
    <dc:creator>Tharun-Kumar</dc:creator>
    <dc:date>2023-08-11T04:54:22Z</dc:date>
    <item>
      <title>AnalysisException: [UC_COMMAND_NOT_SUPPORTED] Spark higher-order functions are not supported in Unity Catalog.;</title>
      <link>https://community.databricks.com/t5/data-engineering/analysisexception-uc-command-not-supported-spark-higher-order/m-p/4149#M949</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;forecast_date = '2017-12-01'
spark.conf.set('spark.sql.shuffle.partitions', 500 ) 
 
# generate forecast for this data
forecasts = (
  history
  .where(history.date &amp;lt; forecast_date) # limit training data to prior to our forecast date
  .groupBy('store', 'item', lit(30).alias('days_to_forecast'))
    .applyInPandas(get_forecast, "store integer, item integer, date timestamp, sales float, sales_pred_mean float, sales_pred_lower float, sales_pred_upper float")
    .withColumn('forecast_date', lit(forecast_date).cast(TimestampType())) 
    ).cache()
 
forecast_evals = (
  forecasts      
    .select('forecast_date', 'store', 'item', 'sales', 'sales_pred_mean')
    .where(forecasts.date &amp;lt; forecasts.forecast_date)
    .groupBy('forecast_date', 'store', 'item')
    .applyInPandas(evaluate_forecast, "forecast_date timestamp, store integer, item integer, mse float, rmse float, mae float, mape float")
    )
 
forecast_evals_cv = (
  forecasts      
    .select('forecast_date', 'store', 'item', 'sales', 'sales_pred_mean')
    .where(forecasts.date &amp;lt; forecasts.forecast_date)
    .groupBy('forecast_date', 'store', 'item', lit(30).alias('days_to_forecast'))
    .applyInPandas(evaluate_forecast_cv, "forecast_date timestamp, store integer, item integer, horizon integer, mse float, rmse float, mae float, mape float, mdape float, coverage float")
    )
 
forecasts.createOrReplaceTempView('forecasts_tmp')
forecast_evals.createOrReplaceTempView('forecast_evals_tmp')
forecast_evals_cv.createOrReplaceTempView('forecast_evals_cv_tmp')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When I run the above code, it's throwing error&lt;/P&gt;&lt;P&gt;&lt;B&gt;AnalysisException: [UC_COMMAND_NOT_SUPPORTED] Spark higher-order functions are not supported in Unity Catalog.;&lt;/B&gt;&lt;/P&gt;&lt;P&gt;I'm using a shared cluster with 12.2 LTS Databricks Runtime and unity catalog is enabled.&lt;/P&gt;&lt;P&gt;Also getting similar error for faker package.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 May 2023 14:41:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/analysisexception-uc-command-not-supported-spark-higher-order/m-p/4149#M949</guid>
      <dc:creator>Mr_K</dc:creator>
      <dc:date>2023-05-19T14:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: AnalysisException: [UC_COMMAND_NOT_SUPPORTED] Spark higher-order functions are not supported in</title>
      <link>https://community.databricks.com/t5/data-engineering/analysisexception-uc-command-not-supported-spark-higher-order/m-p/39461#M26989</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/65069"&gt;@Mr_K&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Running applyInPandas on UC enabled cluster is not currently supported.&lt;/P&gt;&lt;P&gt;As an alternative/interim solution we suggest to implement the forecast function as a Spark UDF&amp;nbsp;&lt;/P&gt;&lt;P&gt;For more information on currently supported Python UDF's please check release notes &lt;A href="https://docs.databricks.com/en/release-notes/runtime/13.2.html#unity-catalog-support-for-python-and-pandas-user-defined-functions-udfs" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 16:40:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/analysisexception-uc-command-not-supported-spark-higher-order/m-p/39461#M26989</guid>
      <dc:creator>User16502773013</dc:creator>
      <dc:date>2023-08-09T16:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: AnalysisException: [UC_COMMAND_NOT_SUPPORTED] Spark higher-order functions are not supported in</title>
      <link>https://community.databricks.com/t5/data-engineering/analysisexception-uc-command-not-supported-spark-higher-order/m-p/39569#M27017</link>
      <description>&lt;P&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/65069"&gt;@Mr_K&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ApplyInPandas is a higher order function in Python. As of now, we do not support higher order functions in Unity Catalog. We do support direct calls made to python UDFs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of how to reference UDFs in UC -&amp;nbsp;&lt;A href="https://docs.databricks.com/en/udf/python.html" target="_blank"&gt;https://docs.databricks.com/en/udf/python.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 04:54:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/analysisexception-uc-command-not-supported-spark-higher-order/m-p/39569#M27017</guid>
      <dc:creator>Tharun-Kumar</dc:creator>
      <dc:date>2023-08-11T04:54:22Z</dc:date>
    </item>
  </channel>
</rss>

