You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2023/06/02 10:34:46 UTC

[spark] branch master updated: [SPARK-43063][SQL][FOLLOWUP] Add a space between `->` and value

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

gurwls223 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 fed51b9eeaf [SPARK-43063][SQL][FOLLOWUP] Add a space between `->` and value
fed51b9eeaf is described below

commit fed51b9eeaf50d0b2cbc9e14b91b6dc3fc660075
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Fri Jun 2 19:34:30 2023 +0900

    [SPARK-43063][SQL][FOLLOWUP] Add a space between `->` and value
    
    ### What changes were proposed in this pull request?
    
    This is a follow-up of #40922. This PR aims to add a space between `->` and value.
    
    It seems to be missed here because the original PR already have the same code pattern in other place.
    
    https://github.com/apache/spark/blob/74b04eeffdc4765f56fe3a9e97165b15ed4e2c73/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ToStringBase.scala#L114
    
    ### Why are the changes needed?
    
    **BEFORE**
    ```
    scala> sql("select map('k', null)").show()
    +------------+
    |map(k, NULL)|
    +------------+
    |  {k ->NULL}|
    +------------+
    ```
    
    **AFTER**
    ```
     scala> sql("select map('k', null)").show()
    +------------+
    |map(k, NULL)|
    +------------+
    | {k -> NULL}|
    +------------+
    ```
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    Manual review.
    
    Closes #41432 from dongjoon-hyun/SPARK-43063.
    
    Authored-by: Dongjoon Hyun <do...@apache.org>
    Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
 .../scala/org/apache/spark/sql/catalyst/expressions/ToStringBase.scala  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ToStringBase.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ToStringBase.scala
index 7304d6739e8..ab9f451e88f 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ToStringBase.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ToStringBase.scala
@@ -100,7 +100,7 @@ trait ToStringBase { self: UnaryExpression with TimeZoneAwareExpression =>
           builder.append(keyToUTF8String(keyArray.get(0, kt)).asInstanceOf[UTF8String])
           builder.append(" ->")
           if (valueArray.isNullAt(0)) {
-            if (nullString.nonEmpty) builder.append(nullString)
+            if (nullString.nonEmpty) builder.append(" " + nullString)
           } else {
             builder.append(" ")
             builder.append(valueToUTF8String(valueArray.get(0, vt)).asInstanceOf[UTF8String])


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