LadyForest commented on a change in pull request #13011:
URL: https://github.com/apache/flink/pull/13011#discussion_r615522665
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/constraints/UniqueConstraint.java
##########
@@ -75,21 +76,26 @@ public ConstraintType getType() {
*/
@Override
public final String asSummaryString() {
- final String typeString;
- switch (getType()) {
- case PRIMARY_KEY:
- typeString = "PRIMARY KEY";
- break;
- case UNIQUE_KEY:
- typeString = "UNIQUE";
- break;
- default:
- throw new IllegalStateException("Unknown key
type: " + getType());
- }
-
+ final String typeString = getTypeString();
return String.format("CONSTRAINT %s %s (%s)", getName(),
typeString, String.join(", ", columns));
}
+ /**
+ * Returns constraint's canonical summary. All constraints summary will
be formatted as
+ * <pre>
+ * CONSTRAINT [constraint-name] [constraint-type]
([constraint-definition]) NOT ENFORCED
+ *
+ * E.g CONSTRAINT pk PRIMARY KEY (`f0`, `f1`) NOT ENFORCED
+ * </pre>
+ */
+ public final String asCanonicalString() {
+ final String typeString = getTypeString();
+ return String.format("CONSTRAINT %s %s (%s) NOT ENFORCED",
Review comment:
> We should add `NOT ENFORCED` according the underlying `enforced` flag,
even though it is always flase for now.
Yes, it has been resolved in FLINK-21435
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]