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 50f189b3f48 [SPARK-46066][SQL] Use the Separators API instead of the 
String API to construct the `DefaultPrettyPrinter`
50f189b3f48 is described below

commit 50f189b3f48aad21307d52ad0c90ff4d9ac5e06d
Author: yangjie01 <yangji...@baidu.com>
AuthorDate: Fri Nov 24 17:26:43 2023 -0800

    [SPARK-46066][SQL] Use the Separators API instead of the String API to 
construct the `DefaultPrettyPrinter`
    
    ### What changes were proposed in this pull request?
    This pr use the `Separators` API instead of the `String` API to construct 
Jackson `DefaultPrettyPrinter` due to the   `String` API has been marked as 
deprecated in Jackson 2.16.0:
    
    ```java
        /**
         * Constructor that specifies separator String to use between root 
values;
         * if null, no separator is printed.
         *<p>
         * Note: simply constructs a {link SerializedString} out of parameter,
         * calls {link #DefaultPrettyPrinter(SerializableString)}
         *
         * param rootSeparator String to use as root value separator
         * deprecated in 2.16. Use the Separators API instead.
         */
        Deprecated
        public DefaultPrettyPrinter(String rootSeparator) {
            this((rootSeparator == null) ? null : new 
SerializedString(rootSeparator));
        }
    
    ```
    
    ### Why are the changes needed?
    Clean up deprecated Jackson API usage.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Pass Github Actions
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #43973 from LuciferYang/jackson-216-Deprecated.
    
    Lead-authored-by: yangjie01 <yangji...@baidu.com>
    Co-authored-by: YangJie <yangji...@baidu.com>
    Signed-off-by: Dongjoon Hyun <dh...@apple.com>
---
 .../scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala    | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala
index e02b2860618..e01457ff102 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonGenerator.scala
@@ -75,7 +75,8 @@ class JacksonGenerator(
   private val gen = {
     val generator = new 
JsonFactory().createGenerator(writer).setRootValueSeparator(null)
     if (options.pretty) {
-      generator.setPrettyPrinter(new DefaultPrettyPrinter(""))
+      generator.setPrettyPrinter(
+        new 
DefaultPrettyPrinter(PrettyPrinter.DEFAULT_SEPARATORS.withRootSeparator("")))
     }
     if (options.writeNonAsciiCharacterAsCodePoint) {
       generator.setHighestNonEscapedChar(0x7F)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to