cloud-fan commented on code in PR #39133:
URL: https://github.com/apache/spark/pull/39133#discussion_r1054443970
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/FunctionRegistry.scala:
##########
@@ -960,8 +960,34 @@ object TableFunctionRegistry {
(name, (info, (expressions: Seq[Expression]) => builder(expressions)))
}
+ def generator[T <: Generator : ClassTag](name: String, outer: Boolean =
false)
+ : (String, (ExpressionInfo, TableFunctionBuilder)) = {
+ val (info, builder) = FunctionRegistryBase.build[T](name, since = None)
+ val newBuilder = (expressions: Seq[Expression]) => {
+ val generator = builder(expressions)
+ assert(generator.isInstanceOf[Generator])
+ // Check nested generators.
+ if (expressions.exists(_.find(_.isInstanceOf[Generator]).nonEmpty)) {
+ throw QueryCompilationErrors.nestedGeneratorError(generator)
+ }
+ // If the generator is not resolved, leave the output empty and wait for
CheckAnalysis
+ // to throw appropriate exceptions.
Review Comment:
do we have tests for this case?
--
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]