maropu commented on a change in pull request #31550:
URL: https://github.com/apache/spark/pull/31550#discussion_r578132323
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
##########
@@ -3943,6 +3943,43 @@ class SQLQuerySuite extends QueryTest with
SharedSparkSession with AdaptiveSpark
}
}
}
+
+ test("SPARK-34421: Resolve temporary functions and views in views with
CTEs") {
+ val tempViewName = "temp_view"
+
+ withTempView(tempViewName) {
+ spark.udf.register("temp_func", identity[Int](_))
Review comment:
Could you use `withUserDefinedFunction`?
##########
File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
##########
@@ -3943,6 +3943,43 @@ class SQLQuerySuite extends QueryTest with
SharedSparkSession with AdaptiveSpark
}
}
}
+
+ test("SPARK-34421: Resolve temporary functions and views in views with
CTEs") {
Review comment:
Is this issue only related to a temp function case? How about a
permanent one?
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala
##########
@@ -557,23 +557,30 @@ object ViewHelper {
private def collectTemporaryObjects(
catalog: SessionCatalog, child: LogicalPlan): (Seq[Seq[String]],
Seq[String]) = {
def collectTempViews(child: LogicalPlan): Seq[Seq[String]] = {
- child.collect {
+ child.flatMap {
Review comment:
I have the same comment, too. IMO the previous one looks okay.
----------------------------------------------------------------
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]