Github user gatorsmile commented on a diff in the pull request: https://github.com/apache/spark/pull/16579#discussion_r97240285 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala --- @@ -982,6 +982,28 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext { spark.sessionState.conf.clear() } + test("SPARK-19218 Fix SET command to show a result correctly and in a sorted order") { + val overrideConfs = sql("SET").collect() + sql(s"SET test.key3=1") + sql(s"SET test.key2=2") + sql(s"SET test.key1=3") + val result = sql("SET").collect() + assert(result === + (overrideConfs ++ Seq( + Row("test.key1", "3"), + Row("test.key2", "2"), + Row("test.key3", "1"))).sortBy(_.getString(0)) + ) + + // Previsouly, `SET -v` fails with NPE during decoding for null value. + import SQLConf._ + SQLConfigBuilder("spark.test").doc("doc").stringConf.createWithDefault(null) + + val result2 = sql("SET -v").collect() + assert(result2 === result2.sortBy(_.getString(0))) + spark.sessionState.conf.clear() --- End diff -- This will not drop the `spark.test`. We need to introduce a function for testing only ```Scala // For testing only private[sql] def unregister(entry: ConfigEntry[_]): Unit = sqlConfEntries.synchronized { sqlConfEntries.remove(entry.key) } ``` Create a separate test case; then call the following code in a finally block: `SQLConf.unregister(confEntry)` Will be back after a few hours.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org