aboutsummaryrefslogtreecommitdiff
path: root/sql/core/src/test/scala
diff options
context:
space:
mode:
authorMarcelo Vanzin <vanzin@cloudera.com>2016-08-15 11:09:54 -0700
committerMarcelo Vanzin <vanzin@cloudera.com>2016-08-15 11:09:54 -0700
commit5da6c4b24f512b63cd4e6ba7dd8968066a9396f5 (patch)
tree7bf18c71a8c55eef6539bc484a73a2e20d97d4e1 /sql/core/src/test/scala
parent564fe614c11deb657e0ac9e6b75e65370c48b7fe (diff)
downloadspark-5da6c4b24f512b63cd4e6ba7dd8968066a9396f5.tar.gz
spark-5da6c4b24f512b63cd4e6ba7dd8968066a9396f5.tar.bz2
spark-5da6c4b24f512b63cd4e6ba7dd8968066a9396f5.zip
[SPARK-16671][CORE][SQL] Consolidate code to do variable substitution.
Both core and sql have slightly different code that does variable substitution of config values. This change refactors that code and encapsulates the logic of reading config values and expading variables in a new helper class, which can be configured so that both core and sql can use it without losing existing functionality, and allows for easier testing and makes it easier to add more features in the future. Tested with existing and new unit tests, and by running spark-shell with some configs referencing variables and making sure it behaved as expected. Author: Marcelo Vanzin <vanzin@cloudera.com> Closes #14468 from vanzin/SPARK-16671.
Diffstat (limited to 'sql/core/src/test/scala')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/internal/VariableSubstitutionSuite.scala18
1 files changed, 0 insertions, 18 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/internal/VariableSubstitutionSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/internal/VariableSubstitutionSuite.scala
index deac95918b..d5a946aeaa 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/internal/VariableSubstitutionSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/internal/VariableSubstitutionSuite.scala
@@ -57,22 +57,4 @@ class VariableSubstitutionSuite extends SparkFunSuite {
assert(sub.substitute(q) == "select 1 1 this is great")
}
- test("depth limit") {
- val q = "select ${bar} ${foo} ${doo}"
- conf.setConfString(SQLConf.VARIABLE_SUBSTITUTE_DEPTH.key, "2")
-
- // This should be OK since it is not nested.
- conf.setConfString("bar", "1")
- conf.setConfString("foo", "2")
- conf.setConfString("doo", "3")
- assert(sub.substitute(q) == "select 1 2 3")
-
- // This should not be OK since it is nested in 3 levels.
- conf.setConfString("bar", "1")
- conf.setConfString("foo", "${bar}")
- conf.setConfString("doo", "${foo}")
- intercept[AnalysisException] {
- sub.substitute(q)
- }
- }
}