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

wenchen 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 27f4d1ef848 [SPARK-41468][SQL][FOLLOWUP] Handle NamedLambdaVariables 
in EquivalentExpressions
27f4d1ef848 is described below

commit 27f4d1ef848caf357faaf90d7ee4f625e0a3b5d3
Author: Peter Toth <peter.t...@gmail.com>
AuthorDate: Tue Dec 13 17:05:08 2022 +0800

    [SPARK-41468][SQL][FOLLOWUP] Handle NamedLambdaVariables in 
EquivalentExpressions
    
    ### What changes were proposed in this pull request?
    This is a follow-up PR to https://github.com/apache/spark/pull/39010 to 
handle `NamedLambdaVariable`s too.
    
    ### Why are the changes needed?
    To avoid possible issues with higer-order functions.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Existing UTs.
    
    Closes #39046 from 
peter-toth/SPARK-41468-fix-planexpressions-in-equivalentexpressions-follow-up.
    
    Authored-by: Peter Toth <peter.t...@gmail.com>
    Signed-off-by: Wenchen Fan <wenc...@databricks.com>
---
 .../spark/sql/catalyst/expressions/EquivalentExpressions.scala       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala
index 3ffd9f9d887..330d66a21be 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala
@@ -144,9 +144,10 @@ class EquivalentExpressions {
 
   private def supportedExpression(e: Expression) = {
     !e.exists {
-      // `LambdaVariable` is usually used as a loop variable, which can't be 
evaluated ahead of the
-      // loop. So we can't evaluate sub-expressions containing 
`LambdaVariable` at the beginning.
+      // `LambdaVariable` is usually used as a loop variable and 
`NamedLambdaVariable` is used in
+      // higher-order functions, which can't be evaluated ahead of the 
execution.
       case _: LambdaVariable => true
+      case _: NamedLambdaVariable => true
 
       // `PlanExpression` wraps query plan. To compare query plans of 
`PlanExpression` on executor,
       // can cause error like NPE.


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

Reply via email to