Skip to content

Commit 01baf1b

Browse files
peter-tothattilapiros
authored andcommitted
CDPD-47467. [SPARK-41468][SQL][FOLLOWUP] Handle NamedLambdaVariables in EquivalentExpressions
This is a follow-up PR to apache#39010 to handle `NamedLambdaVariable`s too. To avoid possible issues with higer-order functions. No. Existing UTs. Closes apache#39046 from peter-toth/SPARK-41468-fix-planexpressions-in-equivalentexpressions-follow-up. Change-Id: I6166bc79b2f60cf802d6c9e438b0a6e710201b24 Authored-by: Peter Toth <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
1 parent 81ff0d8 commit 01baf1b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/EquivalentExpressions.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,10 @@ class EquivalentExpressions {
148148

149149
private def supportedExpression(e: Expression) = {
150150
!e.exists {
151-
// `LambdaVariable` is usually used as a loop variable, which can't be evaluated ahead of the
152-
// loop. So we can't evaluate sub-expressions containing `LambdaVariable` at the beginning.
151+
// `LambdaVariable` is usually used as a loop variable and `NamedLambdaVariable` is used in
152+
// higher-order functions, which can't be evaluated ahead of the execution.
153153
case _: LambdaVariable => true
154+
case _: NamedLambdaVariable => true
154155

155156
// `PlanExpression` wraps query plan. To compare query plans of `PlanExpression` on executor,
156157
// can cause error like NPE.

0 commit comments

Comments
 (0)