Skip to content

Commit 0a19585

Browse files
committed
review
1 parent 267dbed commit 0a19585

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

.github/workflows/build_and_test.yml

+14-5
Original file line numberDiff line numberDiff line change
@@ -435,23 +435,32 @@ jobs:
435435
steps:
436436
- name: Checkout Spark repository
437437
uses: actions/checkout@v2
438+
- name: Cache TPC-DS generated data
439+
id: cache-tpcds-sf-1
440+
uses: actions/cache@v2
441+
with:
442+
path: ./tpcds-sf-1
443+
key: tpcds-${{ hashFiles('tpcds-sf-1/.spark-tpcds-sf-1.md5') }}
444+
restore-keys: |
445+
tpcds-
438446
- name: Checkout TPC-DS (SF=1) generated data repository
447+
if: steps.cache-tpcds-sf-1.outputs.cache-hit != 'true'
439448
uses: actions/checkout@v2
440449
with:
441450
repository: maropu/spark-tpcds-sf-1
442451
path: ./tpcds-sf-1
443-
- name: Cache TPC-DS generated data
452+
- name: Cache Coursier local repository
444453
uses: actions/cache@v2
445454
with:
446-
path: ./tpcds-sf-1
447-
key: tpcds-${{ hashFiles('tpcds-sf-1/.spark-tpcds-sf-1.md5') }}
455+
path: ~/.cache/coursier
456+
key: tpcds-coursier-${{ hashFiles('**/pom.xml', '**/plugins.sbt') }}
448457
restore-keys: |
449-
tpcds-
458+
tpcds-coursier-
450459
- name: Install Java 8
451460
uses: actions/setup-java@v1
452461
with:
453462
java-version: 8
454-
- name: Run TPCDSQueryTestSuite
463+
- name: Run TPC-DS queries
455464
run: |
456465
SPARK_TPCDS_DATA=`pwd`/tpcds-sf-1 build/sbt "sql/testOnly org.apache.spark.sql.TPCDSQueryTestSuite"
457466
- name: Upload test results to report

sql/core/src/test/scala/org/apache/spark/sql/TPCDSQueryTestSuite.scala

+8-8
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ import org.apache.spark.sql.test.TestSparkSession
5353
*/
5454
class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelper {
5555

56-
private val tpcdsDataPath = System.getenv("SPARK_TPCDS_DATA")
57-
private val regenerateGoldenFiles = System.getenv("SPARK_GENERATE_GOLDEN_FILES") == "1"
56+
private val tpcdsDataPath = sys.env.get("SPARK_TPCDS_DATA")
57+
private val regenerateGoldenFiles = sys.env.get("SPARK_GENERATE_GOLDEN_FILES").exists(_ == "1")
5858

5959
// To make output results deterministic
6060
protected override def sparkConf: SparkConf = super.sparkConf
@@ -67,12 +67,12 @@ class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelp
6767
// We use SF=1 table data here, so we cannot use SF=100 stats
6868
protected override val injectStats: Boolean = false
6969

70-
if (tpcdsDataPath != null) {
70+
if (tpcdsDataPath.nonEmpty) {
7171
val nonExistentTables = tableNames.filterNot { tableName =>
72-
Files.exists(Paths.get(s"$tpcdsDataPath/$tableName"))
72+
Files.exists(Paths.get(s"${tpcdsDataPath.get}/$tableName"))
7373
}
7474
if (nonExistentTables.nonEmpty) {
75-
fail(s"Non-existent TPCDS table paths found in $tpcdsDataPath: " +
75+
fail(s"Non-existent TPCDS table paths found in ${tpcdsDataPath.get}: " +
7676
nonExistentTables.mkString(", "))
7777
}
7878
}
@@ -92,7 +92,7 @@ class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelp
9292
s"""
9393
|CREATE TABLE `$tableName` (${tableColumns(tableName)})
9494
|USING $format
95-
|LOCATION '$tpcdsDataPath/$tableName'
95+
|LOCATION '${tpcdsDataPath.get}/$tableName'
9696
|${options.mkString("\n")}
9797
""".stripMargin)
9898
}
@@ -134,7 +134,7 @@ class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelp
134134
assertResult(expectedOutput, s"Result did not match\n$queryString") { outputString }
135135
}
136136

137-
if (tpcdsDataPath != null) {
137+
if (tpcdsDataPath.nonEmpty) {
138138
tpcdsQueries.foreach { name =>
139139
val queryString = resourceToString(s"tpcds/$name.sql",
140140
classLoader = Thread.currentThread().getContextClassLoader)
@@ -153,6 +153,6 @@ class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelp
153153
}
154154
}
155155
} else {
156-
ignore("skipped because env `SPARK_TPCDS_DATA` is not given") {}
156+
ignore("skipped because env `SPARK_TPCDS_DATA` is not set") {}
157157
}
158158
}

0 commit comments

Comments
 (0)