Commit 5beaa5b
[SPARK-56353][BUILD][TESTS] Generate Java-based test JARs dynamically instead of storing pre-built binaries
### What changes were proposed in this pull request?
This PR is a part of SPARK-56352 for Java-based test JARs, replacing pre-built test JAR files containing Java classes with dynamic compilation at test time, removing 7 binary JAR files from the repository.
Changes:
- Add `TestUtils.createJarWithJavaSources()` in `SparkTestUtils.scala` that compiles Java source code with `javac` and packages the resulting classes into a JAR.
- Externalize Java source files for Hive UDFs/UDAFs/UDTFs to `src/test/resources/` (9 files), loaded at test time via `getContextClassLoader.getResource()`. These source files were reverse-engineered from the class files in the pre-built JARs, as no original source code existed in the repository.
- Update test suites to use dynamically generated JARs instead of pre-built ones.
- Remove deleted JAR entries from `dev/test-jars.txt`.
JARs removed:
- `core/src/test/resources/TestUDTF.jar`
- `sql/core/src/test/resources/SPARK-33084.jar`
- `sql/hive-thriftserver/src/test/resources/TestUDTF.jar`
- `sql/hive/src/test/noclasspath/hive-test-udfs.jar`
- `sql/hive/src/test/resources/SPARK-21101-1.0.jar`
- `sql/hive/src/test/resources/TestUDTF.jar`
- `sql/hive/src/test/resources/data/files/TestSerDe.jar`
### Why are the changes needed?
As noted in the PR discussion [here](#50378 (review)):
> the ultimate goal is to refactor the tests to automatically build the jars instead of using pre-built ones
This PR achieves that goal for all Java-based test JARs. By generating JARs dynamically at test time, no binary artifacts need to be stored in the source tree, and the release-time workaround becomes unnecessary for these files.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
All affected test suites pass:
- SparkContextSuite, SparkSubmitSuite, TaskSetManagerSuite (core)
- SQLQuerySuite (sql/core)
- HiveUDFDynamicLoadSuite, HiveDDLSuite, HiveQuerySuite, HiveUDFSuite, SQLQuerySuite (sql/hive)
- CliSuite, HiveThriftServer2Suites (sql/hive-thriftserver)
No tests were added or removed. Existing tests now compile Java sources at
runtime instead of loading pre-built JARs.
### Was this patch authored or co-authored using generative AI tooling?
Kiro CLI / Opus 4.6
Closes #55192 from sarutak/remove-test-jars-ab.
Authored-by: Kousuke Saruta <sarutak@amazon.co.jp>
Signed-off-by: Cheng Pan <chengpan@apache.org>1 parent 732f30b commit 5beaa5b
33 files changed
Lines changed: 1341 additions & 86 deletions
File tree
- common/utils/src/main/scala/org/apache/spark/util
- core/src/test
- resources
- scala/org/apache/spark
- deploy
- executor
- scheduler
- dev
- sql
- core/src/test
- resources
- SPARK-33084
- scala/org/apache/spark/sql
- hive-thriftserver/src/test
- resources
- scala/org/apache/spark/sql/hive/thriftserver
- hive/src/test
- noclasspath
- resources
- SPARK-21101
- data/files
- hive-test-udfs
- scala/org/apache/spark/sql/hive
- execution
- test
Lines changed: 65 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
102 | 166 | | |
103 | 167 | | |
104 | 168 | | |
Binary file not shown.
Lines changed: 5 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | | - | |
| 247 | + | |
249 | 248 | | |
250 | 249 | | |
251 | 250 | | |
252 | | - | |
| 251 | + | |
253 | 252 | | |
254 | 253 | | |
255 | 254 | | |
256 | 255 | | |
257 | 256 | | |
258 | 257 | | |
259 | 258 | | |
260 | | - | |
| 259 | + | |
261 | 260 | | |
262 | 261 | | |
263 | | - | |
| 262 | + | |
264 | 263 | | |
265 | 264 | | |
266 | 265 | | |
| |||
402 | 401 | | |
403 | 402 | | |
404 | 403 | | |
405 | | - | |
406 | | - | |
| 404 | + | |
407 | 405 | | |
408 | 406 | | |
409 | 407 | | |
| |||
Lines changed: 17 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
112 | 116 | | |
113 | 117 | | |
114 | 118 | | |
| |||
502 | 506 | | |
503 | 507 | | |
504 | 508 | | |
505 | | - | |
506 | | - | |
| 509 | + | |
507 | 510 | | |
508 | 511 | | |
509 | 512 | | |
| |||
518 | 521 | | |
519 | 522 | | |
520 | 523 | | |
521 | | - | |
| 524 | + | |
522 | 525 | | |
523 | 526 | | |
524 | 527 | | |
525 | | - | |
526 | | - | |
| 528 | + | |
527 | 529 | | |
528 | 530 | | |
529 | 531 | | |
| |||
548 | 550 | | |
549 | 551 | | |
550 | 552 | | |
| 553 | + | |
551 | 554 | | |
552 | 555 | | |
553 | 556 | | |
554 | | - | |
| 557 | + | |
555 | 558 | | |
556 | 559 | | |
557 | 560 | | |
558 | | - | |
| 561 | + | |
559 | 562 | | |
560 | 563 | | |
561 | 564 | | |
562 | 565 | | |
563 | 566 | | |
564 | | - | |
565 | | - | |
| 567 | + | |
| 568 | + | |
566 | 569 | | |
567 | 570 | | |
568 | 571 | | |
| |||
588 | 591 | | |
589 | 592 | | |
590 | 593 | | |
591 | | - | |
| 594 | + | |
592 | 595 | | |
593 | 596 | | |
594 | 597 | | |
595 | 598 | | |
596 | | - | |
| 599 | + | |
597 | 600 | | |
598 | 601 | | |
599 | 602 | | |
600 | 603 | | |
601 | | - | |
| 604 | + | |
602 | 605 | | |
603 | 606 | | |
604 | 607 | | |
| |||
1932 | 1935 | | |
1933 | 1936 | | |
1934 | 1937 | | |
1935 | | - | |
| 1938 | + | |
1936 | 1939 | | |
1937 | 1940 | | |
1938 | 1941 | | |
| |||
1945 | 1948 | | |
1946 | 1949 | | |
1947 | 1950 | | |
1948 | | - | |
| 1951 | + | |
1949 | 1952 | | |
1950 | 1953 | | |
1951 | 1954 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | 54 | | |
56 | 55 | | |
57 | 56 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1573 | 1573 | | |
1574 | 1574 | | |
1575 | 1575 | | |
1576 | | - | |
1577 | | - | |
| 1576 | + | |
1578 | 1577 | | |
1579 | 1578 | | |
1580 | 1579 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
8 | 7 | | |
9 | 8 | | |
10 | | - | |
11 | 9 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 10 | | |
Binary file not shown.
| 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 | + | |
Lines changed: 15 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
59 | | - | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
3865 | 3868 | | |
3866 | 3869 | | |
3867 | 3870 | | |
3868 | | - | |
3869 | | - | |
3870 | | - | |
3871 | 3871 | | |
| 3872 | + | |
| 3873 | + | |
| 3874 | + | |
| 3875 | + | |
| 3876 | + | |
| 3877 | + | |
| 3878 | + | |
| 3879 | + | |
| 3880 | + | |
| 3881 | + | |
3872 | 3882 | | |
3873 | 3883 | | |
3874 | 3884 | | |
3875 | | - | |
3876 | 3885 | | |
3877 | 3886 | | |
3878 | 3887 | | |
3879 | 3888 | | |
3880 | | - | |
| 3889 | + | |
3881 | 3890 | | |
3882 | 3891 | | |
3883 | 3892 | | |
| |||
0 commit comments