<?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 Serverless Compute - Spark - Jobs failing with Max iterations (1000) reached for batch Resolution in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/131706#M49201</link>
    <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Hello Community,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;We have been trying to migrate our jobs from Classic Compute to Serverless Compute. As part of this process, we face several challenges, and this is one of them.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;When we try to execute the existing jobs with Serverless Compute, if the job deals with a small amount of data or a small number of stages, Serverless Compute works great. But when we try to use the Serverless Compute for processing a large amount of data with a large number of intermediate transformations, the job fails with the following error:&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Exception: (java.lang.RuntimeException) Max iterations (1000) reached for batch Resolution, please set 'spark.sql.analyzer.maxIterations' to a larger value&lt;/LI-CODE&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;This error indicates that the query plan required more than the default 1000 iterations to resolve, likely due to deeply nested logic or complex transformations in our code. However, in serverless environments, the spark.sql.analyzer.maxIterations configuration is not accessible or overridable, as it is not exposed via Spark Connect.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;Has anyone faced the similar issue?&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;Any suggestion or recommendation is greatly appreciated.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Screenshots:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ramana_1-1757620107637.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19926i1DED40510DB8C48F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ramana_1-1757620107637.png" alt="Ramana_1-1757620107637.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ramana_0-1757620075091.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19925i87A664CE888C2208/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ramana_0-1757620075091.png" alt="Ramana_0-1757620075091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;#ServerlessCompute&lt;/P&gt;&lt;P&gt;#DataEngineering&lt;/P&gt;&lt;P&gt;#ClassicCompute-to-ServerlessCompute-Migration&lt;/P&gt;&lt;P&gt;#Migration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Sep 2025 19:50:07 GMT</pubDate>
    <dc:creator>Ramana</dc:creator>
    <dc:date>2025-09-11T19:50:07Z</dc:date>
    <item>
      <title>Serverless Compute - Spark - Jobs failing with Max iterations (1000) reached for batch Resolution</title>
      <link>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/131706#M49201</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Hello Community,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;We have been trying to migrate our jobs from Classic Compute to Serverless Compute. As part of this process, we face several challenges, and this is one of them.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;When we try to execute the existing jobs with Serverless Compute, if the job deals with a small amount of data or a small number of stages, Serverless Compute works great. But when we try to use the Serverless Compute for processing a large amount of data with a large number of intermediate transformations, the job fails with the following error:&lt;/FONT&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Exception: (java.lang.RuntimeException) Max iterations (1000) reached for batch Resolution, please set 'spark.sql.analyzer.maxIterations' to a larger value&lt;/LI-CODE&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;This error indicates that the query plan required more than the default 1000 iterations to resolve, likely due to deeply nested logic or complex transformations in our code. However, in serverless environments, the spark.sql.analyzer.maxIterations configuration is not accessible or overridable, as it is not exposed via Spark Connect.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;Has anyone faced the similar issue?&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT face="courier new,courier"&gt;Any suggestion or recommendation is greatly appreciated.&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Screenshots:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ramana_1-1757620107637.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19926i1DED40510DB8C48F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ramana_1-1757620107637.png" alt="Ramana_1-1757620107637.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ramana_0-1757620075091.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/19925i87A664CE888C2208/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ramana_0-1757620075091.png" alt="Ramana_0-1757620075091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;#ServerlessCompute&lt;/P&gt;&lt;P&gt;#DataEngineering&lt;/P&gt;&lt;P&gt;#ClassicCompute-to-ServerlessCompute-Migration&lt;/P&gt;&lt;P&gt;#Migration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Sep 2025 19:50:07 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/131706#M49201</guid>
      <dc:creator>Ramana</dc:creator>
      <dc:date>2025-09-11T19:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: Serverless Compute - Spark - Jobs failing with Max iterations (1000) reached for batch Resolutio</title>
      <link>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/131850#M49264</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/40873"&gt;@Ramana&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P class=""&gt;The above error occurs when the Spark SQL optimiser is unable to resolve a query within the fixed maximum number of rule-application iterations (default 1000) in its internal logical plan "Resolution" phase. This typically happens with particularly complex queries, especially those that involve:&lt;/P&gt;&lt;UL class=""&gt;&lt;LI&gt;Excessively deep or "chained" query plans, often produced when repeatedly applying DataFrame transformations, like many chained .withColumn() calls&lt;/LI&gt;&lt;LI&gt;Highly nested views or subqueries, especially those involving multiple self-joins or recursive structures&lt;/LI&gt;&lt;LI&gt;Generated query plans with conflicting or redundant attributes&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In Databricks serverless and some managed environments, most Spark SQL configs—including spark.sql.analyzer.maxIterations—cannot be changed/Thus, increasing the setting is not possible as a workaround on serverless.&lt;/P&gt;&lt;P&gt;So the only way is to reduce the complexity of the logical plan the analyser generates, and that can be done by optimising your query by breaking it down to smaller steps, materializing each before proceeding to the next transformation.&lt;/P&gt;&lt;P&gt;Please let me know if you have any further questions&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Sep 2025 10:22:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/131850#M49264</guid>
      <dc:creator>K_Anudeep</dc:creator>
      <dc:date>2025-09-13T10:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Serverless Compute - Spark - Jobs failing with Max iterations (1000) reached for batch Resolutio</title>
      <link>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/131995#M49318</link>
      <description>&lt;P&gt;Thanks for sharing your thoughts.&lt;/P&gt;&lt;P&gt;The job(s) actually failing are simple SELECT * FROM source_table WHERE where_clause with some level of JDBC partitioning and then simple transformations like casting the data types, applying some regex, etc., (may be some 10-15 different transformations) at the dataframe level. These jobs are not at all complex, but still fail when we have a large amount of data. I don't think a logical plan varies based on data. I know logical plan varies based on the number/type of transformations, but not by the size of the data (mostly), there may be some exceptions.&lt;/P&gt;&lt;P&gt;Persisting data at every intermediate state is not a good idea, especially with Serverless, because of no support for caching/persisting/ some level of tempview creations.&lt;/P&gt;&lt;P&gt;I can do optimizations of complex queries, but I don't have any scope to optimize the simple SELECT and simple dataframe transformations.&lt;/P&gt;&lt;P&gt;The main goal of Serverless is to reduce this kind of burden on the processes by implementing these techniques dynamically, which is the reason Databricks does not allow us to set any custom configurations. If we need to do all of this, then Databricks should allow us to set these configurations.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 14:19:18 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/131995#M49318</guid>
      <dc:creator>Ramana</dc:creator>
      <dc:date>2025-09-15T14:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: Serverless Compute - Spark - Jobs failing with Max iterations (1000) reached for batch Resolutio</title>
      <link>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/132058#M49337</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/40873"&gt;@Ramana&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You’re right that data volume doesn’t change the logical plan, but your pattern (Example: SELECT * from a wide table + 10–15 column transforms) can still exceed the analyzer’s fixed iteration cap on Serverless, because each * expansion and chained withColumn/casts/regex adds more alias resolution work, resulting in a huge stack of projections causing the analyzer to break.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would suggest that you understand what optimiser rules are being applied and why they are exceeding the default max values by setting&lt;EM&gt;&lt;STRONG&gt;&amp;nbsp;spark.sql.planChangeLog.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;level to INFO &lt;/STRONG&gt;&lt;/EM&gt;and then simplify the code as required.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 04:50:40 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/132058#M49337</guid>
      <dc:creator>K_Anudeep</dc:creator>
      <dc:date>2025-09-16T04:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Serverless Compute - Spark - Jobs failing with Max iterations (1000) reached for batch Resolutio</title>
      <link>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/132132#M49363</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;But the same job with a limit clause works great. I don't think it is related to the logical plan, but I will look into your suggestion for tracing the issue down.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If serverless doesn't work for these basic transformations, it will be tough to utilize for complex jobs (like dynamic code generation jobs), which is what I am trying to convey here.&lt;/P&gt;&lt;P&gt;Migration from Classic to Serverless is not a straightforward approach, and it appears that most classic compute jobs should be rewritten to execute in Serverless.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Sep 2025 15:01:15 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/132132#M49363</guid>
      <dc:creator>Ramana</dc:creator>
      <dc:date>2025-09-16T15:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: Serverless Compute - Spark - Jobs failing with Max iterations (1000) reached for batch Resolutio</title>
      <link>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/132310#M49434</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/60098"&gt;@K_Anudeep&lt;/a&gt;&amp;nbsp;&lt;STRONG&gt;FYI:&lt;/STRONG&gt; Serverless Compute doesn't support&amp;nbsp;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;spark.sql.planChangeLog.level&lt;/FONT&gt;.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;If we try to set up, the job will fail with&amp;nbsp;&lt;FONT color="#FF0000"&gt;[CONFIG_NOT_AVAILABLE] Configuration spark.sql.planChangeLog.level is not available. SQLSTATE: 42K0I&lt;/FONT&gt; error.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;Classic Compute supports (as expected). I am trying to capture the statistics on Classic, but so far, I don't see any suspicious statistics on Classic. Since I set the node type, min, and max workers, Classic can accommodate the load. However, when it comes to Serverless, I have no idea how to view these stats because there is &lt;STRONG&gt;no Spark UI available&lt;/STRONG&gt; in Serverless Jobs (I know that the Serverless has the Query history option but not sure how this replaces the Spark UI).&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;I feel like switching from Classic to Serverless is an architectural change versus a simple migration/Spark version upgrade.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;I will share the Classic stats soon.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;That being said, I don't think Serverless is fit for any of my company's Spark jobs, at least for now; this may change in the future.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Sep 2025 18:06:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/132310#M49434</guid>
      <dc:creator>Ramana</dc:creator>
      <dc:date>2025-09-17T18:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Serverless Compute - Spark - Jobs failing with Max iterations (1000) reached for batch Resolutio</title>
      <link>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/138842#M51026</link>
      <description>&lt;P&gt;In &lt;A href="https://docs.databricks.com/aws/en/release-notes/serverless/environment-version/four" target="_self"&gt;Serverless Version 4&lt;/A&gt;, Databricks fixed this issue.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Nov 2025 22:10:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/serverless-compute-spark-jobs-failing-with-max-iterations-1000/m-p/138842#M51026</guid>
      <dc:creator>Ramana</dc:creator>
      <dc:date>2025-11-12T22:10:48Z</dc:date>
    </item>
  </channel>
</rss>

