You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by gatorsmile <gi...@git.apache.org> on 2017/07/03 04:11:03 UTC
[GitHub] spark pull request #18469: [SPARK-21256] [SQL] Add withSQLConf to Catalyst T...
Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/18469#discussion_r125207314
--- Diff: sql/core/src/test/scala/org/apache/spark/sql/test/SQLTestUtils.scala ---
@@ -89,28 +92,11 @@ private[sql] trait SQLTestUtils
}
}
- /**
- * Sets all SQL configurations specified in `pairs`, calls `f`, and then restore all SQL
- * configurations.
- *
- * @todo Probably this method should be moved to a more general place
- */
- protected def withSQLConf(pairs: (String, String)*)(f: => Unit): Unit = {
- val (keys, values) = pairs.unzip
- val currentValues = keys.map { key =>
- if (spark.conf.contains(key)) {
- Some(spark.conf.get(key))
- } else {
- None
- }
- }
- (keys, values).zipped.foreach(spark.conf.set)
- try f finally {
- keys.zip(currentValues).foreach {
- case (key, Some(value)) => spark.conf.set(key, value)
- case (key, None) => spark.conf.unset(key)
- }
- }
+ protected override def withSQLConf(pairs: (String, String)*)(f: => Unit): Unit = {
+ // ensure spark's session has been initialized and set to the current SQLConf.confGetter
+ // TODO: fix the multi-session supports for SQLConf.confGetter
+ SQLConf.setSQLConfGetter(() => spark.sessionState.conf)
--- End diff --
Ideally, directly calling `withSQLConf` of `PlanTest` should work. That means, this line is not needed. However, it does not work in the current `SQLConf.confGetter`. Another PR is needed to fix that issue.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org