gengliangwang commented on code in PR #50584: URL: https://github.com/apache/spark/pull/50584#discussion_r2047967092
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/constraints.scala: ########## @@ -38,36 +40,59 @@ trait TableConstraint { */ def withName(name: String): TableConstraint + /** + * Creates a new constraint with the given table name + * + * @param tableName Name of the table containing this constraint + * @return New TableConstraint instance + */ + def withTableName(tableName: String): TableConstraint + /** Creates a new constraint with the given characteristic * * @param c Constraint characteristic (ENFORCED, RELY) - * @param ctx Parser context for error reporting * @return New TableConstraint instance */ - def withCharacteristic(c: ConstraintCharacteristic, ctx: ParserRuleContext): TableConstraint + def withCharacteristic(c: ConstraintCharacteristic): TableConstraint // Generate a constraint name based on the table name if the name is not specified protected def generateConstraintName(tableName: String): String - /** Generates a constraint name if one is not provided + + /** + * Gets the constraint name. If no name is specified (null or empty), + * generates a name based on the table name using generateConstraintName. * - * @param tableName Name of the table containing this constraint - * @return TableConstraint with a generated name if original name was null/empty + * @return The constraint name (either user-specified or generated) */ - def generateConstraintNameIfNeeded(tableName: String): TableConstraint = { + final def constraintName: String = { Review Comment: Yes -- 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