szehon-ho commented on code in PR #50701:
URL: https://github.com/apache/spark/pull/50701#discussion_r2069680175
##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala:
##########
@@ -3560,11 +3560,10 @@ class DataSourceV2SQLSuiteV1Filter
val exception = analysisException(
// Rand function is not foldable
s"ALTER TABLE tab ADD COLUMN col2 DOUBLE DEFAULT rand()")
- assert(exception.getSqlState == "42623")
- assert(exception.errorClass.get ==
"INVALID_DEFAULT_VALUE.NOT_CONSTANT")
- assert(exception.messageParameters("colName") == "`col2`")
- assert(exception.messageParameters("defaultValue") == "rand()")
- assert(exception.messageParameters("statement") == "ALTER TABLE")
+ assert(exception.getSqlState == "42K0E")
Review Comment:
Note: the exception changes here because now existsDefault is analyzed as
part of the main loop, instead of separately by call to ResolveDefaultColumns.
However, as that code had custom pretty exceptions for ADD COLUMN DEFAULT VALUE
(see https://github.com/apache/spark/pull/42810), those get lost.
I was able to fix the other ones, but for this one , there is not enough
information at the end of Analyzer phase ( when analyzed value is copied to
existsDefault) about which non-foldable expression will error. Some of these
expressions are replaced later by optimizer (ReplaceCurrentLike).
--
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]