aboutsummaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authorMarcelo Vanzin <vanzin@cloudera.com>2016-04-05 15:19:51 -0700
committerMarcelo Vanzin <vanzin@cloudera.com>2016-04-05 15:19:51 -0700
commitd5ee9d5c240fca5c15b21efc4a760b06a1f39fd6 (patch)
treeb0c0d55466cdd5678849cc32d914408f9dd84472 /project
parent7329fe272d3ead7db9bc3e1e32adb7329dabc607 (diff)
downloadspark-d5ee9d5c240fca5c15b21efc4a760b06a1f39fd6.tar.gz
spark-d5ee9d5c240fca5c15b21efc4a760b06a1f39fd6.tar.bz2
spark-d5ee9d5c240fca5c15b21efc4a760b06a1f39fd6.zip
[SPARK-529][SQL] Modify SQLConf to use new config API from core.
Because SQL keeps track of all known configs, some customization was needed in SQLConf to allow that, since the core API does not have that feature. Tested via existing (and slightly updated) unit tests. Author: Marcelo Vanzin <vanzin@cloudera.com> Closes #11570 from vanzin/SPARK-529-sql.
Diffstat (limited to 'project')
-rw-r--r--project/SparkBuild.scala18
1 files changed, 16 insertions, 2 deletions
diff --git a/project/SparkBuild.scala b/project/SparkBuild.scala
index b32480b164..60124ef0a1 100644
--- a/project/SparkBuild.scala
+++ b/project/SparkBuild.scala
@@ -20,6 +20,7 @@ import java.nio.file.Files
import scala.util.Properties
import scala.collection.JavaConverters._
+import scala.collection.mutable.Stack
import sbt._
import sbt.Classpaths.publishTask
@@ -742,8 +743,21 @@ object TestSettings {
parallelExecution in Test := false,
// Make sure the test temp directory exists.
resourceGenerators in Test <+= resourceManaged in Test map { outDir: File =>
- if (!new File(testTempDir).isDirectory()) {
- require(new File(testTempDir).mkdirs(), s"Error creating temp directory $testTempDir.")
+ var dir = new File(testTempDir)
+ if (!dir.isDirectory()) {
+ // Because File.mkdirs() can fail if multiple callers are trying to create the same
+ // parent directory, this code tries to create parents one at a time, and avoids
+ // failures when the directories have been created by somebody else.
+ val stack = new Stack[File]()
+ while (!dir.isDirectory()) {
+ stack.push(dir)
+ dir = dir.getParentFile()
+ }
+
+ while (stack.nonEmpty) {
+ val d = stack.pop()
+ require(d.mkdir() || d.isDirectory(), s"Failed to create directory $d")
+ }
}
Seq[File]()
},