dongjoon-hyun commented on code in PR #50631:
URL: https://github.com/apache/spark/pull/50631#discussion_r2066637707


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -1138,6 +1138,15 @@ trait CheckAnalysis extends LookupCatalog with 
QueryErrorsBase with PlanToString
       case RenameColumn(table: ResolvedTable, col: ResolvedFieldName, newName) 
=>
         checkColumnNotExists("rename", col.path :+ newName, table.schema)
 
+
+      case AddConstraint(_: ResolvedTable, check: CheckConstraint) =>
+        if (!check.deterministic) {
+          check.child.failAnalysis(
+            errorClass = "NON_DETERMINISTIC_CHECK_CONSTRAINT",
+            messageParameters = Map("checkCondition" -> check.condition)
+          )
+        }

Review Comment:
   Maybe, the following style is simpler.
   ```scala
   -      case AddConstraint(_: ResolvedTable, check: CheckConstraint) =>
   -        if (!check.deterministic) {
   -          check.child.failAnalysis(
   -            errorClass = "NON_DETERMINISTIC_CHECK_CONSTRAINT",
   -            messageParameters = Map("checkCondition" -> check.condition)
   -          )
   -        }
   +      case AddConstraint(_: ResolvedTable, check: CheckConstraint) if 
!check.deterministic =>
   +        check.child.failAnalysis(
   +          errorClass = "NON_DETERMINISTIC_CHECK_CONSTRAINT",
   +          messageParameters = Map("checkCondition" -> check.condition)
   +        )
   ```



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