linhongliu-db opened a new pull request #34473: URL: https://github.com/apache/spark/pull/34473
### What changes were proposed in this pull request? Add a new function wrapper called `RegisteredSimpleFunction`, so that we can identify the functions among all the expressions. Because of this, when creating temp views, we can collect all temporary functions created both by SQL or catalog API. ### Why are the changes needed? fix regression. After we choose to store the sql text instead of a logical plan for a view, we couldn't collect the temporary functions registered by catalog API. For example: ```scala val func = CatalogFunction(FunctionIdentifier("tempFunc", None), ...) val builder = (e: Seq[Expression]) => e.head spark.sessionState.catalog.registerFunction(func, Some(builder)) sql("create temp view tv as select temp1(a, b) from values (1, 2) t(a, b)") sql("select * from tv").collect() ``` We will get an exception for the above code: ``` Undefined function: 'tempFunc'. This function is neither a registered temporary function nor a permanent function registered in the database 'default'.; ``` ### Does this PR introduce _any_ user-facing change? No, it's a bug-fix. ### How was this patch tested? newly added UT -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org