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

yumwang 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 6fa910b2ab6 [SPARK-43859][SQL] Override toString in 
LateralColumnAliasReference
6fa910b2ab6 is described below

commit 6fa910b2ab6ac619cda76608a109d69e71a8c09d
Author: Yuming Wang <yumw...@ebay.com>
AuthorDate: Wed May 31 13:11:59 2023 +0800

    [SPARK-43859][SQL] Override toString in LateralColumnAliasReference
    
    ### What changes were proposed in this pull request?
    
    This PR makes it override `toString` in `LateralColumnAliasReference`.
    
    ### Why are the changes needed?
    
    Improve the readability of logical plans.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Manual test:
    ```sql
    select id + 1 as a1, a1 + 2 as a3 from range(10);
    ```
    Before this PR:
    ```
    Project [(id#2L + 1) AS a1#0, (lateralAliasReference('a1, a1, 'a1) + 2) AS 
a3#1]
    +- Range (0, 10, step=1, splits=None)
    ```
    
    After this  PR:
    ```
    Project [(id#2L + 1) AS a1#0, (lateralAliasReference(a1) + 2) AS a3#1]
    +- Range (0, 10, step=1, splits=None)
    ```
    
    Closes #41359 from wangyum/SPARK-43859.
    
    Authored-by: Yuming Wang <yumw...@ebay.com>
    Signed-off-by: Yuming Wang <yumw...@ebay.com>
---
 .../org/apache/spark/sql/catalyst/expressions/namedExpressions.scala     | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala
index 4f4fbc07b16..c0ab13c4e9e 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/namedExpressions.scala
@@ -459,6 +459,7 @@ case class LateralColumnAliasReference(ne: NamedExpression, 
nameParts: Seq[Strin
   override def dataType: DataType = ne.dataType
   override def prettyName: String = "lateralAliasReference"
   override def sql: String = s"$prettyName($name)"
+  override def toString: String = sql
 
   final override val nodePatterns: Seq[TreePattern] = 
Seq(LATERAL_COLUMN_ALIAS_REFERENCE)
 }


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

Reply via email to