cloud-fan commented on code in PR #54126:
URL: https://github.com/apache/spark/pull/54126#discussion_r2838201622
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -719,6 +739,35 @@ trait CheckAnalysis extends LookupCatalog with
QueryErrorsBase with PlanToString
TypeUtils.failUnsupportedDataType(create.tableSchema, SQLConf.get)
SchemaUtils.checkIndeterminateCollationInSchema(create.tableSchema)
+ // Validate generated column expressions
+ create.columns.foreach { col =>
+ col.generationExpression.foreach { genExpr =>
+ def unsupportedExpressionError(reason: String):
AnalysisException = {
+ new AnalysisException(
+ errorClass = "UNSUPPORTED_EXPRESSION_GENERATED_COLUMN",
+ messageParameters = Map(
+ "fieldName" -> col.name,
+ "expressionStr" -> genExpr.originalSQL,
+ "reason" -> reason
+ )
+ )
+ }
+ // Check for user-defined functions - only built-in functions
are allowed
+ // in generated columns. Traverse the entire expression tree.
+ genExpr.child.foreach {
+ case u: UnresolvedFunction =>
Review Comment:
why do we check this? It will trigger no such function anyway.
--
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]