@@ -51,20 +51,19 @@ class PaimonSparkSessionExtensions extends (SparkSessionExtensions => Unit) {
5151 extensions.injectPostHocResolutionRule(_ => PaimonDeleteTable )
5252 extensions.injectPostHocResolutionRule(spark => PaimonMergeInto (spark))
5353
54- // Spark 4.1 additionally registers Update/Delete rules in the Resolution batch. Spark 4.1 moved
55- // its own RewriteUpdateTable / RewriteDeleteFromTable into the Resolution batch and marks the
56- // plan as analyzed=true before postHoc rules run. The postHoc rule's transformed output is then
57- // silently dropped for UpdateTable / DeleteFromTable nodes, leaving them in the plan for the
58- // physical planner to reject with UNSUPPORTED_FEATURE.TABLE_OPERATION. Running these rules in
59- // the Resolution batch lets Paimon's rewrite actually stick. Each rule skips tables advertising
60- // SupportsRowLevelOperations (gated on the same Spark 4.1 version check) so Spark's built-in
61- // rewrite owns the V2 row-level path for useV2Write=true tables. `PaimonMergeInto` is
62- // intentionally left out here — the postHoc path already works for merge plans (verified by
63- // Blob merge tests passing pre-Round-8 on PR 7648) and re-registering it in the Resolution
64- // batch introduced regressions on Blob tests.
54+ // Spark 4.1 additionally registers the same rules in the Resolution batch. Spark 4.1 moved its
55+ // own RewriteUpdateTable / RewriteDeleteFromTable / RewriteMergeIntoTable into the Resolution
56+ // batch and marks the plan as analyzed=true before postHoc rules run. The postHoc rule's
57+ // transformed output is then silently dropped, leaving the original UpdateTable / DeleteFromTable
58+ // / MergeIntoTable in the plan for the physical planner to reject with
59+ // UNSUPPORTED_FEATURE.TABLE_OPERATION. Running them in the Resolution batch lets Paimon's
60+ // rewrite actually stick. The rules themselves skip tables advertising SupportsRowLevelOperations
61+ // (gated on the same Spark 4.1 version check), so Spark's built-in rewrite still owns the V2
62+ // row-level path for useV2Write=true tables.
6563 if (org.apache.spark.SPARK_VERSION >= " 4.1" ) {
6664 extensions.injectResolutionRule(_ => PaimonUpdateTable )
6765 extensions.injectResolutionRule(_ => PaimonDeleteTable )
66+ extensions.injectResolutionRule(spark => PaimonMergeInto (spark))
6867 }
6968
7069 // table function extensions
0 commit comments