szehon-ho commented on code in PR #49840: URL: https://github.com/apache/spark/pull/49840#discussion_r1950287853
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/ResolveDefaultColumnsUtil.scala: ########## @@ -320,6 +319,29 @@ object ResolveDefaultColumns extends QueryErrorsBase coerceDefaultValue(analyzed, dataType, statementType, colName, defaultSQL) Review Comment: synced with @cloud-fan offline, this is not constant folded after this line to make EXISTS_DEFAULT. So in the input of analyzeExistsDefault() we get sometimes a top level CAST from EXISTS_DEFAULT. ########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/literals.scala: ########## @@ -265,6 +267,23 @@ object Literal { s"Literal must have a corresponding value to ${dataType.catalogString}, " + s"but class ${Utils.getSimpleName(value.getClass)} found.") } + + def fromSQL(sql: String): Expression = { + CatalystSqlParser.parseExpression(sql).transformUp { + case u: UnresolvedFunction => + assert(u.nameParts.length == 1) + assert(!u.isDistinct) + assert(u.filter.isEmpty) + assert(!u.ignoreNulls) + assert(u.orderingWithinGroup.isEmpty) + assert(!u.isInternal) + FunctionRegistry.builtin.lookupFunction(FunctionIdentifier(u.nameParts.head), u.arguments) + } match { + case c: Cast if c.needsTimeZone => Review Comment: synced offline, see the other comment. -- 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