Commit 2b8e9f5
committed
[SPARK-57128][SQL][TESTS] SQLQueryTestHelper --SET parser must preserve commas in config values
What changes were proposed in this pull request?
`SQLQueryTestHelper.getSparkSettings` splits `--SET` directive values on every
comma, which conflicts with Spark configs whose values themselves contain commas
(e.g. `spark.sql.optimizer.excludedRules` accepts a comma-separated rule list).
The current parser crashes with `StringIndexOutOfBoundsException` when it
encounters such a value.
Change the split to only occur at commas that are immediately followed by what
looks like a new `key=` (word characters or dots ending in `=`). This preserves
the documented multi-setting form `--SET k1=v1,k2=v2` while allowing values to
contain commas.
Adds `SQLQueryTestHelperSuite` with focused unit tests.
Why are the changes needed?
The parser cannot currently express settings whose values contain commas,
forcing users to scope down their SET to a single value. This was hit when
trying to specify a multi-rule `excludedRules` value in Apache Gluten's spark41
SQL test workaround (apache/gluten#12165).
Does this PR introduce any user-facing change?
No. Test-framework-only change. Existing tests that rely on the documented
multi-setting form continue to parse as before.
How was this patch tested?
New `SQLQueryTestHelperSuite` with 6 cases covering: single setting, multi-
setting in one `--SET`, multiple `--SET` lines, comma-containing value,
mixed, and non-SET comments. All pass.1 parent fc5abd6 commit 2b8e9f5
2 files changed
Lines changed: 70 additions & 1 deletion
File tree
- sql/core/src/test/scala/org/apache/spark/sql
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
474 | 474 | | |
475 | 475 | | |
476 | 476 | | |
477 | | - | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
478 | 483 | | |
479 | 484 | | |
480 | 485 | | |
| |||
Lines changed: 64 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 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
0 commit comments