@@ -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