peter-toth commented on code in PR #59749:
URL: https://github.com/apache/spark/pull/59749#discussion_r4360189465


##########
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala:
##########
@@ -6211,6 +6211,32 @@ class DataFrameFunctionsSuite extends SharedSparkSession 
{
     )
   }
 
+  test("SPARK-60508: nested higher-order functions capturing different lambda 
variables") {

Review Comment:
   **Finding 1.** The description also fixes the Python UDF example, which only 
the manual run covers. `ExtractPythonUDFFromLambdaSuite` checks the lifting on 
the optimized plan with dummy UDFs, so it needs no Python worker. This passes 
here and fails on `master` without the fix, where the two calls are merged into 
one lifted UDF:
   
   ```scala
     test("SPARK-60508: calls capturing different lambda variables are lifted 
distinctly") {
       val df = Seq((Seq(1, 2), Seq(10, 20), Seq(0, 5, 15))).toDF("l", "r", 
"c").select(
         zip_with(col("l"), col("r"), (a, b) =>
           pythonUDF(filter(col("c"), y => y < a)) || 
pythonUDF(filter(col("c"), y => y < b)))
           .as("res"))
       assert(udfsInsideLambda(df).isEmpty)
       assert(liftedUDFs(df).size == 2)
     }
   ```
   
   It needs `filter` in the suite's `functions` import.
   



-- 
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