wangyum commented on a change in pull request #33522:
URL: https://github.com/apache/spark/pull/33522#discussion_r743679266



##########
File path: sql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala
##########
@@ -1057,7 +1057,7 @@ class JoinSuite extends QueryTest with SharedSparkSession 
with AdaptiveSparkPlan
     val pythonEvals = collect(joinNode.get) {
       case p: BatchEvalPythonExec => p
     }
-    assert(pythonEvals.size == 2)
+    assert(pythonEvals.size == 4)

Review comment:
       It is because we will infer two `isnotnull(cast(pythonUDF0 as int))`:
   ```
   == Optimized Logical Plan ==
   Project [a#225, b#226, c#236, d#237]
   +- Join Inner, (CAST(udf(cast(a as string)) AS INT)#250 = CAST(udf(cast(c as 
string)) AS INT)#251)
      :- Project [_1#220 AS a#225, _2#221 AS b#226, cast(pythonUDF0#253 as int) 
AS CAST(udf(cast(a as string)) AS INT)#250]
      :  +- BatchEvalPython [udf(cast(_1#220 as string))], [pythonUDF0#253]
      :     +- Project [_1#220, _2#221]
      :        +- Filter isnotnull(cast(pythonUDF0#252 as int))
      :           +- BatchEvalPython [udf(cast(_1#220 as string))], 
[pythonUDF0#252]
      :              +- LocalRelation [_1#220, _2#221]
      +- Project [_1#231 AS c#236, _2#232 AS d#237, cast(pythonUDF0#255 as int) 
AS CAST(udf(cast(c as string)) AS INT)#251]
         +- BatchEvalPython [udf(cast(_1#231 as string))], [pythonUDF0#255]
            +- Project [_1#231, _2#232]
               +- Filter isnotnull(cast(pythonUDF0#254 as int))
                  +- BatchEvalPython [udf(cast(_1#231 as string))], 
[pythonUDF0#254]
                     +- LocalRelation [_1#231, _2#232]
   ```
   
   Before this pr:
   ```
   == Optimized Logical Plan ==
   Project [a#225, b#226, c#236, d#237]
   +- Join Inner, (cast(pythonUDF0#250 as int) = cast(pythonUDF0#251 as int))
      :- BatchEvalPython [udf(cast(a#225 as string))], [pythonUDF0#250]
      :  +- Project [_1#220 AS a#225, _2#221 AS b#226]
      :     +- LocalRelation [_1#220, _2#221]
      +- BatchEvalPython [udf(cast(c#236 as string))], [pythonUDF0#251]
         +- Project [_1#231 AS c#236, _2#232 AS d#237]
            +- LocalRelation [_1#231, _2#232]
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to