From 450fe3d1bf3208ba4b7ac24723f6bea8e5b5d38a Mon Sep 17 00:00:00 2001 From: Peter Toth Date: Sat, 18 Mar 2023 16:52:13 +0100 Subject: [PATCH] [SPARK-42852][SQL] Revert "[SPARK-41468][SQL][FOLLOWUP] Handle NamedLambdaVariables in EquivalentExpressions" This reverts commit 27f4d1ef848caf357faaf90d7ee4f625e0a3b5d3. --- .../sql/catalyst/expressions/EquivalentExpressions.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 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 330d66a21bea5..3ffd9f9d88750 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,10 +144,9 @@ class EquivalentExpressions { private def supportedExpression(e: Expression) = { !e.exists { - // `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. + // `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. case _: LambdaVariable => true - case _: NamedLambdaVariable => true // `PlanExpression` wraps query plan. To compare query plans of `PlanExpression` on executor, // can cause error like NPE.