Skip to content

Commit 538a44f

Browse files
committed
comments, to upper case
1 parent 79d27c6 commit 538a44f

6 files changed

Lines changed: 12 additions & 11 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
--import higher-order-functions.sql
1+
--IMPORT higher-order-functions.sql

sql/core/src/test/resources/sql-tests/inputs/ansi/interval.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
--import interval.sql
1+
--IMPORT interval.sql
22

33
-- the `interval` keyword can be omitted with ansi mode
44
select 1 year 2 days;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
--- malformed interval literal with ansi mode
2-
--import literals.sql
2+
--IMPORT literals.sql
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
-- tests for interval output style with iso_8601 format
22
--SET spark.sql.intervalOutputStyle = ISO_8601
3-
--import interval-display.sql
3+
--IMPORT interval-display.sql
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
-- tests for interval output style with sql standard format
22
--SET spark.sql.intervalOutputStyle = SQL_STANDARD
3-
--import interval-display.sql
3+
--IMPORT interval-display.sql

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ import org.apache.spark.tags.ExtendedSQLTest
6565
* 1. A list of SQL queries separated by semicolon.
6666
* 2. Lines starting with -- are treated as comments and ignored.
6767
* 3. Lines starting with --SET are used to run the file with the following set of configs.
68-
* 4. Lines starting with --import are used to load queries from another test file.
68+
* 4. Lines starting with --IMPORT are used to load queries from another test file.
6969
*
7070
* For example:
7171
* {{{
@@ -265,9 +265,9 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession {
265265

266266
val (comments, code) = input.split("\n").partition(_.trim.startsWith("--"))
267267

268-
// If `--import` found, load code from another test case file, then insert them
268+
// If `--IMPORT` found, load code from another test case file, then insert them
269269
// into the head in this test.
270-
val importedTestCaseName = comments.filter(_.startsWith("--import ")).map(_.substring(9))
270+
val importedTestCaseName = comments.filter(_.startsWith("--IMPORT ")).map(_.substring(9))
271271
val importedCode = importedTestCaseName.flatMap { testCaseName =>
272272
listTestCases.find(_.name == testCaseName).map { testCase =>
273273
val input = fileToString(new File(testCase.inputFile))
@@ -283,13 +283,14 @@ class SQLQueryTestSuite extends QueryTest with SharedSparkSession {
283283
// Fix misplacement when comment is at the end of the query.
284284
.map(_.split("\n").filterNot(_.startsWith("--")).mkString("\n")).map(_.trim).filter(_ != "")
285285

286-
// When we are regenerating the golden files, we don't need to set any config as they
287-
// all need to return the same result
286+
// When we are regenerating the golden files for test cases without '--IMPORT' specified, or
287+
// running test cases against [[ThriftServerQueryTestSuite], we don't need to set any config as
288+
// they all need to return the same result.
288289
if ((regenerateGoldenFiles && importedTestCaseName.isEmpty) || !isTestWithConfigSets) {
289290
runQueries(queries, testCase, None)
290291
} else {
291292
val configSets = {
292-
val configLines = comments.filter(_.startsWith("--SET")).map(_.substring(5))
293+
val configLines = comments.filter(_.startsWith("--SET ")).map(_.substring(6))
293294
val configs = configLines.map(_.split(",").map { confAndValue =>
294295
val (conf, value) = confAndValue.span(_ != '=')
295296
conf.trim -> value.substring(1).trim

0 commit comments

Comments
 (0)