You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "clownxc (via GitHub)" <gi...@apache.org> on 2023/04/03 13:22:32 UTC

[GitHub] [flink] clownxc commented on a diff in pull request #22301: [FLINK-31426][table] Upgrade the deprecated UniqueConstraint to the n…

clownxc commented on code in PR #22301:
URL: https://github.com/apache/flink/pull/22301#discussion_r1155957023


##########
flink-table/flink-table-common/src/test/java/org/apache/flink/table/api/TableSchemaTest.java:
##########
@@ -328,7 +328,7 @@ void testPrimaryKeyPrinting() {
                                 + " |-- f0: BIGINT NOT NULL\n"
                                 + " |-- f1: STRING NOT NULL\n"
                                 + " |-- f2: DOUBLE NOT NULL\n"
-                                + " |-- CONSTRAINT pk PRIMARY KEY (f0, f2)\n");
+                                + " |-- CONSTRAINT `pk` PRIMARY KEY (`f0`, `f2`) NOT ENFORCED\n");

Review Comment:
   there are some minor differences between the new and old APIs
   ```java   
   public final String asSummaryString() {
           return String.format(
                   "CONSTRAINT %s %s (%s)%s",
                   EncodingUtils.escapeIdentifier(getName()),
                   getTypeString(),
                   columns.stream()
                           .map(EncodingUtils::escapeIdentifier)
                           .collect(Collectors.joining(", ")),
                   isEnforced() ? "" : " NOT ENFORCED");
     }
   ```
    The method `escapeIdentifier` of the new api adds a symbol `` to each field
   ```java
       public static String escapeIdentifier(String s) {
           return "`" + escapeBackticks(s) + "`";
       }
   ```



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org