Commit 0b46c1c
Iceberg 1.11 support for Spark 411, part (1/3): extract version-divergent scan APIs behind a shim (#14881)
Stacked work for #14853 (1/3) — common-code preparation for adding
iceberg-1-11-x.
### Depends on
* #14866 Rebase on this PR
after #14866 merged.
### Description
Refactors `iceberg/common` so the `SparkScan` / `SparkCopyOnWriteScan` /
`SparkBatch` / `DataWriteResult` APIs that diverge between Iceberg
1.10.x and 1.11.x are hidden behind a small interface, with
per-Iceberg-version implementations in `iceberg-1-6-x` / `iceberg-1-9-x`
/ `iceberg-1-10-x`. **No behavior change for the Iceberg versions this
PR ships**; sets the stage for the follow-up PR that adds
`iceberg-1-11-x`.
Common changes:
- `GpuSparkCopyOnWriteScan` → renamed to `GpuSparkCopyOnWriteScanBase`
(abstract). The runtime-filter trait + `filter` method live in a
per-version concrete subclass (1.6/1.9/1.10 mix in
`SupportsRuntimeFiltering` with `filter(Filter[])`; 1.11 will mix in
`SupportsRuntimeV2Filtering` with `filter(Predicate[])`).
- `GpuSparkScan`: rewrite `hasNestedType` via Spark's `readSchema()` +
Spark types so it no longer depends on the 1.10-only
`cpuScan.expectedSchema()`. Dispatch `SparkCopyOnWriteScan` construction
through the new `ShimUtils.newCopyOnWriteScan` factory.
- `GpuSparkBatchQueryScan.toString` uses `cpuScan.description()`
(available in both 1.10 and 1.11) instead of `branch` / `expectedSchema`
/ `filterExpressions` (1.11 removed these).
- `GpuSparkBatchQueryScan.runtimeFilterExpressions` reflective
field-read tolerates both the 1.10 name (`runtimeFilterExpressions`) and
the 1.11 name (`runtimeFilters`).
- `GpuSparkBatch`: same tolerance for `expectedSchema` (1.10) vs
`projection` (1.11).
- `GpuSparkWrite`: type-annotate `new Array[DataFile](0)` so Scala 2.13
doesn't infer `Array[Nothing]` under 1.11's wildcarded
`DataWriteResult.dataFiles()`.
- `IcebergShimUtils` / `ShimUtils`: add `newCopyOnWriteScan(Scan,
RapidsConf, Boolean): GpuScan` factory. The parameter is Spark's public
`Scan` because Iceberg's `SparkCopyOnWriteScan` is package-private —
cross-package callers cannot reference it directly.
Per-Iceberg-version module changes (1.6 / 1.9 / 1.10, all identical for
the V1 path):
- New `GpuSparkCopyOnWriteScan` in `org.apache.iceberg.spark.source` (so
it can reference the package-private `SparkCopyOnWriteScan`). Companion
object exposes `create(Scan, ...): GpuScan` for cross-package callers.
- `ShimUtilsImpl.java` implements `newCopyOnWriteScan` via
`GpuSparkCopyOnWriteScan.create`.
The two `try/catch` field-name fallbacks (in `GpuSparkBatchQueryScan`
and `GpuSparkBatch`) are tactical and will be pushed behind proper
per-version `IcebergShimUtils` methods in a later cleanup PR.
### Checklists
Documentation
- [ ] Updated for new or modified user-facing features or behaviors
- [x] No user-facing change
Testing
- [ ] Added or modified tests to cover new code paths
- [x] Covered by existing tests
(3.5.x + 4.0.x iceberg integration tests in
\`integration_tests/src/main/python/iceberg/\` — exercises the new
dispatch path with no behavior change vs. before this PR.)
- [ ] Not required
Performance
- [ ] Tests ran and results are added in the PR description
- [ ] Issue filed with a link in the PR description
- [x] Not required
Signed-off-by: Chong Gao <res_life@163.com>
Co-authored-by: Chong Gao <res_life@163.com>1 parent 1ff1da3 commit 0b46c1c
11 files changed
Lines changed: 309 additions & 36 deletions
File tree
- iceberg
- common/src/main
- java
- com/nvidia/spark/rapids/iceberg
- org/apache/iceberg/spark/source
- scala/org/apache/iceberg/spark/source
- iceberg-1-10-x/src/main
- java/com/nvidia/spark/rapids/iceberg/iceberg110x
- scala/org/apache/iceberg/spark/source
- iceberg-1-6-x/src/main
- java/com/nvidia/spark/rapids/iceberg/iceberg16x
- scala/org/apache/iceberg/spark/source
- iceberg-1-9-x/src/main
- java/com/nvidia/spark/rapids/iceberg/iceberg19x
- scala/org/apache/iceberg/spark/source
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
98 | 101 | | |
99 | 102 | | |
100 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
101 | 118 | | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
71 | 74 | | |
72 | 75 | | |
73 | 76 | | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
74 | 84 | | |
Lines changed: 73 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
63 | | - | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
71 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
72 | 77 | | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
78 | 83 | | |
79 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
80 | 87 | | |
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
| 93 | + | |
86 | 94 | | |
87 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
88 | 100 | | |
89 | 101 | | |
90 | 102 | | |
| |||
101 | 113 | | |
102 | 114 | | |
103 | 115 | | |
104 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
105 | 121 | | |
106 | 122 | | |
107 | 123 | | |
108 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
109 | 127 | | |
110 | 128 | | |
111 | 129 | | |
| |||
128 | 146 | | |
129 | 147 | | |
130 | 148 | | |
131 | | - | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
132 | 161 | | |
133 | | - | |
134 | 162 | | |
135 | 163 | | |
136 | 164 | | |
137 | 165 | | |
138 | | - | |
| 166 | + | |
139 | 167 | | |
140 | 168 | | |
141 | 169 | | |
142 | | - | |
| 170 | + | |
143 | 171 | | |
144 | 172 | | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
149 | 206 | | |
| 207 | + | |
150 | 208 | | |
151 | | - | |
| 209 | + | |
152 | 210 | | |
153 | 211 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 24 | + | |
27 | 25 | | |
28 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
29 | 37 | | |
30 | 38 | | |
31 | 39 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | | - | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | 65 | | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | | - | |
| 85 | + | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
77 | 89 | | |
Lines changed: 52 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
0 commit comments