@@ -53,8 +53,8 @@ import org.apache.spark.sql.test.TestSparkSession
53
53
*/
54
54
class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelper {
55
55
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" )
58
58
59
59
// To make output results deterministic
60
60
protected override def sparkConf : SparkConf = super .sparkConf
@@ -67,12 +67,12 @@ class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelp
67
67
// We use SF=1 table data here, so we cannot use SF=100 stats
68
68
protected override val injectStats : Boolean = false
69
69
70
- if (tpcdsDataPath != null ) {
70
+ if (tpcdsDataPath.nonEmpty ) {
71
71
val nonExistentTables = tableNames.filterNot { tableName =>
72
- Files .exists(Paths .get(s " $tpcdsDataPath/ $tableName" ))
72
+ Files .exists(Paths .get(s " ${ tpcdsDataPath.get} / $tableName" ))
73
73
}
74
74
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} : " +
76
76
nonExistentTables.mkString(" , " ))
77
77
}
78
78
}
@@ -92,7 +92,7 @@ class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelp
92
92
s """
93
93
|CREATE TABLE ` $tableName` ( ${tableColumns(tableName)})
94
94
|USING $format
95
- |LOCATION ' $tpcdsDataPath/ $tableName'
95
+ |LOCATION ' ${ tpcdsDataPath.get} / $tableName'
96
96
| ${options.mkString(" \n " )}
97
97
""" .stripMargin)
98
98
}
@@ -134,7 +134,7 @@ class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelp
134
134
assertResult(expectedOutput, s " Result did not match \n $queryString" ) { outputString }
135
135
}
136
136
137
- if (tpcdsDataPath != null ) {
137
+ if (tpcdsDataPath.nonEmpty ) {
138
138
tpcdsQueries.foreach { name =>
139
139
val queryString = resourceToString(s " tpcds/ $name.sql " ,
140
140
classLoader = Thread .currentThread().getContextClassLoader)
@@ -153,6 +153,6 @@ class TPCDSQueryTestSuite extends QueryTest with TPCDSBase with SQLQueryTestHelp
153
153
}
154
154
}
155
155
} else {
156
- ignore(" skipped because env `SPARK_TPCDS_DATA` is not given " ) {}
156
+ ignore(" skipped because env `SPARK_TPCDS_DATA` is not set " ) {}
157
157
}
158
158
}
0 commit comments