[SPARK-20070][SQL] Fix 2.10 build

## What changes were proposed in this pull request?
Commit 91fa80fe8a broke the build for scala 2.10. The commit uses `Regex.regex` field which is not available in Scala 2.10. This PR fixes this.

## How was this patch tested?
Existing tests.

Author: Herman van Hovell <hvanhovell@databricks.com>

Closes #17420 from hvanhovell/SPARK-20070-2.0.
This commit is contained in:
Herman van Hovell 2017-03-25 01:07:50 +01:00 committed by Reynold Xin
parent f88f56b835
commit 0a6c50711b
2 changed files with 3 additions and 3 deletions

View file

@ -225,6 +225,6 @@ private[spark] case class ConfigBuilder(key: String) {
}
def regexConf: TypedConfigBuilder[Regex] = {
new TypedConfigBuilder(this, regexFromString(_, this.key), _.regex)
new TypedConfigBuilder(this, regexFromString(_, this.key), _.toString)
}
}

View file

@ -100,10 +100,10 @@ class ConfigEntrySuite extends SparkFunSuite {
val rConf = ConfigBuilder(testKey("regex")).regexConf.createWithDefault(".*".r)
conf.set(rConf, "[0-9a-f]{8}".r)
assert(conf.get(rConf).regex === "[0-9a-f]{8}")
assert(conf.get(rConf).toString === "[0-9a-f]{8}")
conf.set(rConf.key, "[0-9a-f]{4}")
assert(conf.get(rConf).regex === "[0-9a-f]{4}")
assert(conf.get(rConf).toString === "[0-9a-f]{4}")
conf.set(rConf.key, "[.")
val e = intercept[IllegalArgumentException](conf.get(rConf))