gengliangwang commented on code in PR #50631: URL: https://github.com/apache/spark/pull/50631#discussion_r2054485796
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/v2AlterTableCommands.scala: ########## @@ -295,7 +295,16 @@ case class AlterTableCollation( case class AddConstraint( table: LogicalPlan, tableConstraint: TableConstraint) extends AlterTableCommand { - override def changes: Seq[TableChange] = Seq.empty + override def changes: Seq[TableChange] = { + val constraint = tableConstraint.toV2Constraint(isCreateTable = false) + val validatedTableVersion = table match { + case t: ResolvedTable if constraint.enforced() => + t.table.currentVersion() + case _ => + null + } + Seq(TableChange.addConstraint(constraint, validatedTableVersion)) Review Comment: > must optionally validate Make sense. Do you mean `CHECK ... NOT ENFOCED`? -- 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