maropu commented on a change in pull request #31887:
URL: https://github.com/apache/spark/pull/31887#discussion_r607421098
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/functions.scala
##########
@@ -3799,23 +3801,26 @@ object functions {
ArrayExcept(col1.expr, col2.expr)
}
+ // counter to ensure lambda variable names are unique
+ private val lambdaVarNameCounter = new AtomicInteger(0)
Review comment:
How about defining a companion object for UnresolvedNamedLambdaVariable
like this?
```
object UnresolvedNamedLambdaVariable {
// counter to ensure lambda variable names are unique
private val lambdaVarNameCounter = new AtomicInteger(0)
def apply(args: Seq[String]): UnresolvedNamedLambdaVariable = {
// add a counter number in the suffix
}
}
```
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala
##########
@@ -2261,6 +2261,32 @@ class DataFrameFunctionsSuite extends QueryTest with
SharedSparkSession {
assert(ex3.getMessage.contains("cannot resolve 'a'"))
}
+ test("nested transform (DSL)") {
Review comment:
nit: `nested transform (DSL)` -> `SPARK-34794: nested transform`
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala
##########
@@ -2261,6 +2261,32 @@ class DataFrameFunctionsSuite extends QueryTest with
SharedSparkSession {
assert(ex3.getMessage.contains("cannot resolve 'a'"))
}
+ test("nested transform (DSL)") {
+ val df = Seq(
+ (Seq(1, 2, 3), Seq("a", "b", "c"))
+ ).toDF("numbers", "letters")
+
+ checkAnswer(
+ df.select(
+ flatten(
+ transform(
+ $"numbers",
+ (number: Column) => transform(
Review comment:
I think we need exhaustive tests for this issue, e.g., two/three
argument cases and their combination cases.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]