Commit 72ef84b
committed
[spark] Version-conditional Resolution rule for Spark 4.1 row-level rewrites
Spark 4.1 moved its built-in RewriteUpdateTable / RewriteDeleteFromTable /
RewriteMergeIntoTable into the Resolution batch, and the Resolution batch
marks the plan analyzed=true before postHoc rules run. Diagnostic runs on
PR 7648 confirmed that for Spark 4.1 + useV2Write=false + append-only tables,
PaimonUpdateTable's postHoc rule matches, takes the V1 fallback branch, and
returns UpdatePaimonTableCommand, yet the physical planner still sees the
original UpdateTable node and fails with UNSUPPORTED_FEATURE.TABLE_OPERATION.
The transformed plan is silently dropped in Spark 4.1's analyzed-plan flow.
Register PaimonUpdateTable / PaimonDeleteTable / PaimonMergeInto as Resolution
rules ONLY on Spark 4.1+, so their transform output sticks. Spark 3.x keeps
the original postHoc-only registration — it has no competing Resolution-batch
rewrite rule and the postHoc path works as before.
Inside the rules, skip tables that expose SupportsRowLevelOperations when on
Spark 4.1+. Those tables already go through Spark's built-in V2 row-level
rewrite; hijacking them here would force V1 fallback and drop V2-only
signals such as `_ROW_ID`, tripping CheckAnalysis with MISSING_ATTRIBUTES.
The guard is version-gated so Spark 3.2/3.3 (no built-in V2 merge rewrite)
keeps using Paimon's rule for useV2Write=true tables, avoiding the regression
that appeared when the guard was unconditional (Round 6 on PR 7648).1 parent 136ec45 commit 72ef84b
4 files changed
Lines changed: 39 additions & 4 deletions
File tree
- paimon-spark/paimon-spark-common/src/main/scala/org/apache/paimon/spark
- catalyst/analysis
- extensions
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
53 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
54 | 60 | | |
55 | 61 | | |
56 | 62 | | |
| |||
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
45 | 53 | | |
46 | 54 | | |
47 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
48 | 58 | | |
49 | 59 | | |
50 | 60 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
54 | 69 | | |
55 | 70 | | |
56 | 71 | | |
| |||
0 commit comments