Skip to content

Commit

Permalink
update regex pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangxb1987 committed Dec 15, 2017
1 parent f7d5a4d commit 5292329
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private[sql] object DataSourceV2Utils extends Logging {
val keyPrefix = cs.keyPrefix()
require(keyPrefix != null, "The data source config key prefix can't be null.")

val pattern = Pattern.compile(s"^spark\\.datasource\\.$keyPrefix\\.(.*)")
val pattern = Pattern.compile(s"^spark\\.datasource\\.$keyPrefix\\.(.+)")

conf.getAllConfs.flatMap { case (key, value) =>
val m = pattern.matcher(key)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class DataSourceV2UtilsSuite extends SparkFunSuite {
conf.setConfString(s"spark.datasource.$keyPrefix.whateverConfigName", "123")
conf.setConfString(s"spark.sql.$keyPrefix.config.name", "false")
conf.setConfString("spark.datasource.another.config.name", "123")
conf.setConfString(s"spark.datasource.$keyPrefix.", "123")
val cs = classOf[DataSourceV2WithSessionConfig].newInstance()
val confs = DataSourceV2Utils.extractSessionConfigs(cs.asInstanceOf[DataSourceV2], conf)
assert(confs.size == 2)
Expand Down

0 comments on commit 5292329

Please sign in to comment.