You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sr...@apache.org on 2016/11/09 17:48:24 UTC
spark git commit: [SPARK-18292][SQL] LogicalPlanToSQLSuite should not
use resource dependent path for golden file generation
Repository: spark
Updated Branches:
refs/heads/master e256392a1 -> 02c5325b8
[SPARK-18292][SQL] LogicalPlanToSQLSuite should not use resource dependent path for golden file generation
## What changes were proposed in this pull request?
`LogicalPlanToSQLSuite` uses the following command to update the existing answer files.
```bash
SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "hive/test-only *LogicalPlanToSQLSuite"
```
However, after introducing `getTestResourcePath`, it fails to update the previous golden answer files in the predefined directory. This issue aims to fix that.
## How was this patch tested?
It's a testsuite update. Manual.
Author: Dongjoon Hyun <do...@apache.org>
Closes #15789 from dongjoon-hyun/SPARK-18292.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/02c5325b
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/02c5325b
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/02c5325b
Branch: refs/heads/master
Commit: 02c5325b8ff75bf2e5bcb66e0482298ab408b091
Parents: e256392
Author: Dongjoon Hyun <do...@apache.org>
Authored: Wed Nov 9 17:48:16 2016 +0000
Committer: Sean Owen <so...@cloudera.com>
Committed: Wed Nov 9 17:48:16 2016 +0000
----------------------------------------------------------------------
.../apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/02c5325b/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala
index 12d18dc..8696337 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/catalyst/LogicalPlanToSQLSuite.scala
+++ b/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
+ } else {
+ getTestResourcePath("sqlgen")
+ }
+ }
protected override def beforeAll(): Unit = {
super.beforeAll()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org