Forum Discussion
Max iterations (100) reached for batch Resolution, please set 'spark.sql.analyzer.maxIterations' to
- 1 year ago
Hello PraveenVeli
In Spark SQL’s context, “iterations” refer to the number of passes the query analyzer makes through the logical query plan to resolve references, infer types, and apply optimizationsWhy This Applies to Your Fabric Scenario
1. Workspace Boundary Resolution
3. Fabric treats Lakehouses in different workspaces as separate catalogs, forcing Spark to:
• Verify table existence in both environments
• Reconcile schemas across workspaces
• Handle potential credential handoffsEven for 1k rows comparison
-- Implicitly creates nested plans for:
1) Data fetch from Lakehouse A
2) Data fetch from Lakehouse B
3) Join operation
4) Delta transaction log checks
5) Insert operationTry
spark.conf.set("spark.sql.analyzer.maxIterations", "200")
And do df.explain(mode="extended")
Look for Cartesian products or complex subquery patterns
Try
OPTIMIZE delta_table ZORDER BY primary_key;
please give a try and let me know if this works
Thank you nilendraFabric , information you provided greatly helps. In my case (It's in the same lines of what you said), the issue was that I provided incorrect column names in my CTE, which is causing this error. I'm a bit surprised it's not generating the relevant error message. I have a CTE (that retrieves data from Lake-house A in Workspace B) and then use it within the Merge statement to integrate data into Lake-house B in Warehouse B. If the column name does not match the destination (Lake-house B), it throws an actual error indicating that it can't find the field name. I'm running my notebook in Workspace B.