dawidwys commented on a change in pull request #10213: 
[FLINK-12846][table-common] Carry primary key information in TableSchema
URL: https://github.com/apache/flink/pull/10213#discussion_r346833109
 
 

 ##########
 File path: 
flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java
 ##########
 @@ -246,7 +287,28 @@ public DataType toRowDataType() {
         * support multiple watermarks definition yet. But in the future, we 
may support multiple watermarks.
         */
        public List<WatermarkSpec> getWatermarkSpecs() {
-               return watermarkSpecs;
+               return new ArrayList<>(watermarkSpecs);
+       }
+
+       /**
+        * Returns primary key defined on the table. A primary key is consist 
of single or
+        * multiple field names. The returned list will be empty if no primary 
key is defined.
+        *
+        * <p>See the {@link TableSchema} class javadoc for more definition 
about primary key.
+        */
+       public List<String> getPrimaryKey() {
 
 Review comment:
   What do you think about adding a dedicated class for Primary/Unique key?
   
   We could 
   * encapsulate duplicate fields logic there, 
   * we might want to extend it with a constraint alias in the future. 
   * Maybe we decide to keep only a bitset for the key in the future.
   
   If we have it already hidden behind an interface it would be easier to 
evolve it.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

Reply via email to