Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/15789#discussion_r86691489
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala
---
@@ -46,7 +46,15 @@ class LogicalPlanToSQLSuite extends SQLBuilderTest with
SQLTestUtils {
// Used for generating new query answer files by saving
private val regenerateGoldenFiles: Boolean =
System.getenv("SPARK_GENERATE_GOLDEN_FILES") == "1"
- private val goldenSQLPath = getTestResourcePath("sqlgen")
+ private val goldenSQLPath = {
+ // If regenerateGoldenFiles is true, we must be running this in SBT
and we use hard-coded
+ // relative path. Otherwise, we use classloader's getResource to find
the location.
+ if (regenerateGoldenFiles) {
+ java.nio.file.Paths.get("src", "test", "resources",
"sqlgen").toFile.getCanonicalPath
--- End diff --
Yep. I tested this in my private branch in a separate folder. When I
changed the query for `range`, the output file is changed like the following.
```bash
SPARK-18292-SQLGEN:SPARK-18292$ pwd
/Users/dhyun/SPARK-18292-SQLGEN
SPARK-18292-SQLGEN:SPARK-18292$ git branch
* SPARK-18292
master
SPARK-18292-SQLGEN:SPARK-18292$ pwd
/Users/dhyun/SPARK-18292-SQLGEN
SPARK-18292-SQLGEN:SPARK-18292$ git status
On branch SPARK-18292
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: sql/hive/src/test/resources/sqlgen/range.sql
modified:
sql/hive/src/test/scala/org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]