This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 115c6e42586f [SPARK-47911][SQL][FOLLOWUP] Rename UTF8 to UTF-8 in 
spark.sql.binaryOutputStyle
115c6e42586f is described below

commit 115c6e42586fcf4943430102f803160cd6e6e2d1
Author: Kent Yao <[email protected]>
AuthorDate: Fri Jul 12 10:57:16 2024 -0700

    [SPARK-47911][SQL][FOLLOWUP] Rename UTF8 to UTF-8 in 
spark.sql.binaryOutputStyle
    
    ### What changes were proposed in this pull request?
    
    Make a follow-up for SPARK-47911 to rename UTF8 to UTF-8 of 
`spark.sql.binaryOutputStyle`, so that we could have a consistent name with 
`org.apache.spark.sql.catalyst.util.CharsetProvider.VALID_CHARSETS` and 
`java.nio.charset.StandardCharsets.UTF_8`
    
    ### Why are the changes needed?
    
    reduce cognitive cost for users
    
    ### Does this PR introduce _any_ user-facing change?
    no, unreleased feature
    
    ### How was this patch tested?
    existing tests
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #47322 from yaooqinn/SPARK-47911-FF.
    
    Authored-by: Kent Yao <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 .../src/main/scala/org/apache/spark/sql/internal/SQLConf.scala      | 6 +++---
 .../src/main/scala/org/apache/spark/sql/execution/HiveResult.scala  | 2 +-
 sql/core/src/test/resources/sql-tests/inputs/binary.sql             | 2 +-
 sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala   | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
index 65beb21d59d9..3103ced28214 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala
@@ -1522,12 +1522,12 @@ object SQLConf {
      * Output as UTF-8 string.
      * [83, 112, 97, 114, 107] -> "Spark"
      */
-    UTF8,
+    UTF8: Value = Value("UTF-8")
     /**
      * Output as comma separated byte array string.
      * [83, 112, 97, 114, 107] -> [83, 112, 97, 114, 107]
      */
-    BASIC,
+    val BASIC,
     /**
      * Output as base64 encoded string.
      * [83, 112, 97, 114, 107] -> U3Bhcmsg
@@ -1546,7 +1546,7 @@ object SQLConf {
   }
 
   val BINARY_OUTPUT_STYLE = buildConf("spark.sql.binaryOutputStyle")
-    .doc("The output style used display binary data. Valid values are 'UTF8', 
" +
+    .doc("The output style used display binary data. Valid values are 'UTF-8', 
" +
       "'BASIC', 'BASE64', 'HEX', and 'HEX_DISCRETE'.")
     .version("4.0.0")
     .stringConf
diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
index 8df650ca39b7..28c2ec4b5b7a 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/HiveResult.scala
@@ -51,7 +51,7 @@ object HiveResult extends SQLConfHelper {
   def getBinaryFormatter: BinaryFormatter = {
     if (conf.getConf(SQLConf.BINARY_OUTPUT_STYLE).isEmpty) {
       // Keep the legacy behavior for compatibility.
-      conf.setConf(SQLConf.BINARY_OUTPUT_STYLE, Some("UTF8"))
+      conf.setConf(SQLConf.BINARY_OUTPUT_STYLE, Some("UTF-8"))
     }
     ToStringBase.getBinaryFormatter(_).toString
   }
diff --git a/sql/core/src/test/resources/sql-tests/inputs/binary.sql 
b/sql/core/src/test/resources/sql-tests/inputs/binary.sql
index 8cd33eccaaf0..fc875b0afb0e 100644
--- a/sql/core/src/test/resources/sql-tests/inputs/binary.sql
+++ b/sql/core/src/test/resources/sql-tests/inputs/binary.sql
@@ -1,4 +1,4 @@
---SET spark.sql.binaryOutputStyle=UTF8
+--SET spark.sql.binaryOutputStyle=UTF-8
 
 SELECT X'';
 SELECT X'4561736F6E2059616F20323031382D31312D31373A31333A33333A3333';
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
index 760ee8026080..155acc98cb33 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala
@@ -1067,7 +1067,7 @@ class DataFrameSuite extends QueryTest
       )
       assert(df.getRows(10, 20) === expectedAnswer)
     }
-    withSQLConf(SQLConf.BINARY_OUTPUT_STYLE.key -> "UTF8") {
+    withSQLConf(SQLConf.BINARY_OUTPUT_STYLE.key -> "UTF-8") {
       val expectedAnswer = Seq(
         Seq("_1", "_2"),
         Seq("12", "ABC."),


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to