Commit 5e28e95
[SPARK-48649][SQL] Add "ignoreInvalidPartitionPaths" and "spark.sql.files.ignoreInvalidPartitionPaths" configs to allow ignoring invalid partition paths
### What changes were proposed in this pull request?
This PR adds a new data source config `ignoreInvalidPartitionPaths` and SQL session configuration flag `spark.sql.files.ignoreInvalidPartitionPaths` to control the behaviour of skipping invalid partition paths (base paths).
When the config is enabled, it allows skipping invalid paths such as:
```
table/
invalid/...
part=1/...
part=2/...
part=3/...
```
In this case, `table/invalid` path will be ignored.
Data source option takes precedence over the SQL config so with the code:
```scala
spark.conf.set("spark.sql.files.ignoreInvalidPartitionPaths", "false")
spark.read.format("parquet").option("ignoreInvalidPartitionPaths", "true").load(...)
```
the query would ignore invalid partitions, i.e. the flag will be enabled.
The config is disabled by default.
### Why are the changes needed?
Allows ignoring invalid partition paths that cannot be parsed.
### Does this PR introduce _any_ user-facing change?
No. The added configs are disabled by default to have the exact same behaviour as before.
### How was this patch tested?
I added a unit test for this.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #47006 from sadikovi/SPARK-48649.
Authored-by: Ivan Sadikov <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>1 parent 6ee7c25 commit 5e28e95
File tree
6 files changed
+104
-15
lines changed- sql
- catalyst/src/main/scala/org/apache/spark/sql/internal
- core/src
- main/scala/org/apache/spark/sql/execution/datasources
- test/scala/org/apache/spark/sql/execution/datasources
- parquet
6 files changed
+104
-15
lines changedLines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1977 | 1977 | | |
1978 | 1978 | | |
1979 | 1979 | | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
1980 | 1988 | | |
1981 | 1989 | | |
1982 | 1990 | | |
| |||
5275 | 5283 | | |
5276 | 5284 | | |
5277 | 5285 | | |
| 5286 | + | |
| 5287 | + | |
5278 | 5288 | | |
5279 | 5289 | | |
5280 | 5290 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
| |||
162 | 169 | | |
163 | 170 | | |
164 | 171 | | |
165 | | - | |
| 172 | + | |
| 173 | + | |
166 | 174 | | |
167 | 175 | | |
168 | 176 | | |
| |||
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
| 110 | + | |
110 | 111 | | |
111 | | - | |
| 112 | + | |
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
121 | | - | |
| 122 | + | |
| 123 | + | |
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| |||
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
174 | | - | |
| 176 | + | |
175 | 177 | | |
176 | 178 | | |
177 | 179 | | |
| |||
Lines changed: 63 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
550 | 610 | | |
551 | 611 | | |
552 | 612 | | |
| |||
585 | 645 | | |
586 | 646 | | |
587 | 647 | | |
588 | | - | |
| 648 | + | |
589 | 649 | | |
590 | 650 | | |
| 651 | + | |
591 | 652 | | |
592 | 653 | | |
593 | 654 | | |
| |||
Lines changed: 15 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| |||
129 | 130 | | |
130 | 131 | | |
131 | 132 | | |
132 | | - | |
| 133 | + | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| |||
145 | 147 | | |
146 | 148 | | |
147 | 149 | | |
148 | | - | |
| 150 | + | |
| 151 | + | |
149 | 152 | | |
150 | 153 | | |
151 | 154 | | |
| |||
161 | 164 | | |
162 | 165 | | |
163 | 166 | | |
164 | | - | |
| 167 | + | |
| 168 | + | |
165 | 169 | | |
166 | 170 | | |
167 | 171 | | |
| |||
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
180 | | - | |
| 184 | + | |
| 185 | + | |
181 | 186 | | |
182 | 187 | | |
183 | 188 | | |
| |||
200 | 205 | | |
201 | 206 | | |
202 | 207 | | |
203 | | - | |
| 208 | + | |
| 209 | + | |
204 | 210 | | |
205 | 211 | | |
206 | 212 | | |
| |||
296 | 302 | | |
297 | 303 | | |
298 | 304 | | |
299 | | - | |
| 305 | + | |
| 306 | + | |
300 | 307 | | |
301 | 308 | | |
302 | 309 | | |
| |||
427 | 434 | | |
428 | 435 | | |
429 | 436 | | |
430 | | - | |
| 437 | + | |
431 | 438 | | |
432 | 439 | | |
433 | 440 | | |
| |||
0 commit comments