szehon-ho commented on code in PR #50701:
URL: https://github.com/apache/spark/pull/50701#discussion_r2078302110


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -1022,13 +1022,25 @@ trait CheckAnalysis extends LookupCatalog with 
QueryErrorsBase with PlanToString
       }
     }
 
+    def checkExistsDefaultDeterministic(colsToAdd: Seq[QualifiedColType]): 
Unit = {
+      colsToAdd.foreach { col =>
+        col.default.foreach { d =>
+          if (!d.deterministic) {
+            throw QueryCompilationErrors.defaultValueNotConstantError(

Review Comment:
   this is to pass the test:  
https://github.com/apache/spark/blob/master/sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2SQLSuite.scala#L3564
   
   sorry do you have thought what check I can do instead?  If i change it to 
'!d.foldable', it wont work because optimizer hasnt run yet and we have 
expressions like 1 + 2.
   
   if we dont have this here, we get the generic error 
'INVALID_NON_DETERMINISTIC_EXPRESSIONS' from CheckAnalysis 
(https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala#L887)



-- 
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

Reply via email to