ueshin opened a new pull request, #49327:
URL: https://github.com/apache/spark/pull/49327
### What changes were proposed in this pull request?
Fixes `SparkConnectPlanner` to analyze the inputs for `TypedScalaUdf`.
### Why are the changes needed?
The inputs for `TypedScalaUdf` should be analyzed.
For example:
```scala
val df = Seq(("a", 10), ("a", 20), ("b", 1), ("b", 2), ("c", 1)).toDF("c1",
"c2")
df.select("*").filter(r => r.getInt(1) > 5)
```
fails with:
```
org.apache.spark.SparkException: [INTERNAL_ERROR] Invalid call to
toAttribute on unresolved object SQLSTATE: XX000
at
org.apache.spark.sql.catalyst.analysis.Star.toAttribute(unresolved.scala:438)
at
org.apache.spark.sql.catalyst.plans.logical.Project.$anonfun$output$1(basicLogicalOperators.scala:74)
at scala.collection.immutable.List.map(List.scala:247)
at scala.collection.immutable.List.map(List.scala:79)
at
org.apache.spark.sql.catalyst.plans.logical.Project.output(basicLogicalOperators.scala:74)
at
org.apache.spark.sql.connect.planner.SparkConnectPlanner.transformTypedFilter(SparkConnectPlanner.scala:1460)
at
org.apache.spark.sql.connect.planner.SparkConnectPlanner.transformFilter(SparkConnectPlanner.scala:1437)
...
```
### Does this PR introduce _any_ user-facing change?
The failure will not appear.
### How was this patch tested?
Added the related tests.
### Was this patch authored or co-authored using generative AI tooling?
No.
--
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]