gengliangwang commented on code in PR #50943: URL: https://github.com/apache/spark/pull/50943#discussion_r2096322262
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveTableConstraints.scala: ########## @@ -34,24 +34,35 @@ class ResolveTableConstraints(val catalogManager: CatalogManager) extends Rule[L if v2Write.table.resolved && v2Write.query.resolved && !containsCheckInvariant(v2Write.query) && v2Write.outputResolved => v2Write.table match { - case r: DataSourceV2Relation - if r.table.constraints != null && r.table.constraints.nonEmpty => - // Check constraint is the only enforced constraint for DSV2 tables. - val checkInvariants = r.table.constraints.collect { - case c: Check => - val unresolvedExpr = buildCatalystExpression(c) - val columnExtractors = mutable.Map[String, Expression]() - buildColumnExtractors(unresolvedExpr, columnExtractors) - CheckInvariant(unresolvedExpr, columnExtractors.toSeq, c.name, c.predicateSql) - } - // Combine the check invariants into a single expression using conjunctive AND. - checkInvariants.reduceOption(And).fold(v2Write)( - condition => v2Write.withNewQuery(Filter(condition, v2Write.query))) + case r: DataSourceV2Relation => Review Comment: The changes in this file is purely code clean up. cc @aokolnychyi -- 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