sjwiesman 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_r346895416
########## File path: flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java ########## @@ -22,32 +22,57 @@ import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.common.typeutils.CompositeType; import org.apache.flink.table.types.DataType; -import org.apache.flink.table.types.FieldsDataType; -import org.apache.flink.table.types.logical.LogicalType; import org.apache.flink.table.types.utils.TypeConversions; import org.apache.flink.types.Row; import org.apache.flink.util.Preconditions; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.IntStream; +import static java.util.Collections.emptyList; import static org.apache.flink.table.api.DataTypes.FIELD; import static org.apache.flink.table.api.DataTypes.Field; import static org.apache.flink.table.api.DataTypes.ROW; -import static org.apache.flink.table.types.logical.LogicalTypeRoot.TIMESTAMP_WITHOUT_TIME_ZONE; import static org.apache.flink.table.types.utils.TypeConversions.fromDataTypeToLegacyInfo; import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; +import static org.apache.flink.table.utils.TableSchemaValidation.validateNameTypeNumberEqual; +import static org.apache.flink.table.utils.TableSchemaValidation.validateSchema; /** - * A table schema that represents a table's structure with field names and data types. + * A table schema that represents a table's structure with field names, data types and + * constraint information (e.g. primary key, unique key). + * + * <p>Concepts about primary key and unique key:</p> Review comment: Happy to help. Reading through the JavaDoc I am confused about the difference between a primary key and unique key. It sounds like the primary key is just one of the unique key constraints on a table given a special name but being labeled primary over unique does not provide any additional features or properties. Is that correct? I agree with @dawidwys, a link to a FLIP describing this would be very useful. (cc @wuchong ) ---------------------------------------------------------------- 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
