Skip to content

Commit 48ebd28

Browse files
andygroveclaude
andauthored
docs: Improve documentation on maven usage for running tests (#3370)
* docs: remove -pl from mvn test commands and unnecessary mvn install steps Avoid using -pl spark when running tests since it can cause Maven to pick up stale artifacts from the local repository. Without -pl, Maven builds all modules from source, eliminating the need for a separate mvn install step before running tests or regenerating golden files. Also documents how to run individual SQL file tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * address feedback --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2e24695 commit 48ebd28

3 files changed

Lines changed: 28 additions & 37 deletions

File tree

dev/regenerate-golden-files.sh

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,6 @@ build_native() {
7474
cd native && cargo build && cd ..
7575
}
7676

77-
# Install Comet for a specific Spark version
78-
install_for_spark_version() {
79-
local spark_version=$1
80-
echo ""
81-
echo "=============================================="
82-
echo "[INFO] Installing Comet for Spark $spark_version"
83-
echo "=============================================="
84-
./mvnw install -DskipTests -Pspark-$spark_version
85-
}
86-
8777
# Regenerate golden files for a specific Spark version
8878
regenerate_golden_files() {
8979
local spark_version=$1
@@ -94,12 +84,12 @@ regenerate_golden_files() {
9484
echo "=============================================="
9585

9686
echo "[INFO] Running CometTPCDSV1_4_PlanStabilitySuite..."
97-
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -pl spark \
87+
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw \
9888
-Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" \
9989
-Pspark-$spark_version -nsu test
10090

10191
echo "[INFO] Running CometTPCDSV2_7_PlanStabilitySuite..."
102-
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -pl spark \
92+
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw \
10393
-Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" \
10494
-Pspark-$spark_version -nsu test
10595
}
@@ -158,9 +148,8 @@ main() {
158148
versions=("3.4" "3.5" "4.0")
159149
fi
160150

161-
# Install and regenerate for each version
151+
# Regenerate for each version
162152
for version in "${versions[@]}"; do
163-
install_for_spark_version "$version"
164153
regenerate_golden_files "$version"
165154
done
166155

docs/source/contributor-guide/development.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -191,52 +191,43 @@ Spark version, and runs the plan stability tests with `SPARK_GENERATE_GOLDEN_FIL
191191

192192
Alternatively, you can run the tests manually using the following commands.
193193

194-
First, Comet needs to be installed for each Spark version to be tested:
195-
196-
```sh
197-
./mvnw install -DskipTests -Pspark-3.4
198-
./mvnw install -DskipTests -Pspark-3.5
199-
# note that Spark 4.0 requires JDK 17 or later
200-
./mvnw install -DskipTests -Pspark-4.0
201-
```
202-
203194
Note that the output files get written to `$SPARK_HOME`.
204195

205196
The tests can be run with:
206197

207198
```sh
208199
export SPARK_HOME=`pwd`
209-
./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-3.4 -nsu test
210-
./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-3.5 -nsu test
211-
./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-4.0 -nsu test
200+
./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-3.4 -nsu test
201+
./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-3.5 -nsu test
202+
./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-4.0 -nsu test
212203
```
213204

214205
and
215206

216207
```sh
217208
export SPARK_HOME=`pwd`
218-
./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-3.4 -nsu test
219-
./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-3.5 -nsu test
220-
./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-4.0 -nsu test
209+
./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-3.4 -nsu test
210+
./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-3.5 -nsu test
211+
./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-4.0 -nsu test
221212
```
222213

223214
If your pull request changes the query plans generated by Comet, you should regenerate the golden files.
224215
To regenerate the golden files, you can run the following commands.
225216

226217
```sh
227218
export SPARK_HOME=`pwd`
228-
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-3.4 -nsu test
229-
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-3.5 -nsu test
230-
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-4.0 -nsu test
219+
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-3.4 -nsu test
220+
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-3.5 -nsu test
221+
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV1_4_PlanStabilitySuite" -Pspark-4.0 -nsu test
231222
```
232223

233224
and
234225

235226
```sh
236227
export SPARK_HOME=`pwd`
237-
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-3.4 -nsu test
238-
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-3.5 -nsu test
239-
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -pl spark -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-4.0 -nsu test
228+
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-3.4 -nsu test
229+
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-3.5 -nsu test
230+
SPARK_GENERATE_GOLDEN_FILES=1 ./mvnw -Dsuites="org.apache.spark.sql.comet.CometTPCDSV2_7_PlanStabilitySuite" -Pspark-4.0 -nsu test
240231
```
241232

242233
## Benchmark

docs/source/contributor-guide/sql-file-tests.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,21 @@ way to add expression and operator test coverage without writing Scala test code
2525

2626
## Running the tests
2727

28+
Run all SQL file tests:
29+
30+
```shell
31+
./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite" -Dtest=none
32+
```
33+
34+
Run a single test file by adding the file name (without `.sql` extension) after the suite name:
35+
2836
```shell
29-
mvn test -pl spark -Dsuites="org.apache.comet.CometSqlFileTestSuite" -Dtest=none
37+
./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite create_named_struct" -Dtest=none
3038
```
3139

40+
This uses ScalaTest's substring matching, so the argument must match part of the test name.
41+
Test names follow the pattern `sql-file: expressions/<category>/<file>.sql [<config>]`.
42+
3243
## Test file location
3344

3445
SQL test files live under:
@@ -208,7 +219,7 @@ SELECT space(n) FROM test_space WHERE n < 0
208219
6. Run the tests to verify:
209220

210221
```shell
211-
mvn test -pl spark -Dsuites="org.apache.comet.CometSqlFileTestSuite" -Dtest=none
222+
./mvnw test -Dsuites="org.apache.comet.CometSqlFileTestSuite" -Dtest=none
212223
```
213224

214225
### Tips for writing thorough tests

0 commit comments

Comments
 (0)