gengliangwang commented on code in PR #55590:
URL: https://github.com/apache/spark/pull/55590#discussion_r3157912251


##########
sql/catalyst/src/main/java/org/apache/spark/sql/connector/catalog/constraints/BaseConstraint.java:
##########
@@ -74,13 +74,11 @@ public String toDDL() {
   }
 
   public String toDescription() {

Review Comment:
   Since this PR establishes the invariant `toDDL == "CONSTRAINT " + name + " " 
+ toDescription`, consider implementing it structurally so the two methods 
can't drift apart, e.g. simplify `toDDL` above to:
   
   ```java
   @Override
   public String toDDL() {
     // The validation status is not included in the DDL output as it's not 
part of
     // the Spark SQL syntax for constraints.
     return "CONSTRAINT " + name + " " + toDescription();
   }
   ```
   
   This also removes the duplicated `String.format` template.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to