yaooqinn commented on a change in pull request #29202: URL: https://github.com/apache/spark/pull/29202#discussion_r462321478
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/SetCommand.scala ########## @@ -166,15 +166,21 @@ object SetCommand { * via [[SetCommand]] will get reset to default value. Command that runs * {{{ * reset; + * reset spark.sql.session.timeZone; * }}} */ -case object ResetCommand extends RunnableCommand with IgnoreCachedData { +case class ResetCommand(config: Option[String]) extends RunnableCommand with IgnoreCachedData { override def run(sparkSession: SparkSession): Seq[Row] = { val conf = sparkSession.sessionState.conf - conf.clear() - sparkSession.sparkContext.conf.getAll.foreach { case (k, v) => - conf.setConfString(k, v) + val defaults = sparkSession.sparkContext.conf + config match { + case Some(key) => + conf.unsetConf(key) + defaults.getOption(key).foreach(conf.setConfString(key, _)) Review comment: Looks like the tests for former version reset command didn't cover these cases either, let me add some. ########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/command/SetCommand.scala ########## @@ -166,15 +166,21 @@ object SetCommand { * via [[SetCommand]] will get reset to default value. Command that runs * {{{ * reset; + * reset spark.sql.session.timeZone; * }}} */ -case object ResetCommand extends RunnableCommand with IgnoreCachedData { +case class ResetCommand(config: Option[String]) extends RunnableCommand with IgnoreCachedData { override def run(sparkSession: SparkSession): Seq[Row] = { val conf = sparkSession.sessionState.conf - conf.clear() - sparkSession.sparkContext.conf.getAll.foreach { case (k, v) => - conf.setConfString(k, v) + val defaults = sparkSession.sparkContext.conf Review comment: I'm ok to keep it consistent with SET command ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org