flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] dawidwys commented on a change in pull request #10213: [FLINK-12846][table-common] Carry primary key information in TableSchema
Date Fri, 15 Nov 2019 15:27:51 GMT
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_r346833524
 
 

 ##########
 File path: flink-table/flink-table-common/src/test/java/org/apache/flink/table/api/TableSchemaTest.java
 ##########
 @@ -192,4 +198,52 @@ public void testDifferentWatermarkStrategyOutputTypes() {
 		});
 	}
 
+	@Test
+	public void testInvalidPrimaryKeyFieldName() {
+		thrown.expectMessage("The primary key field 'd' is not existed in the schema");
+		TableSchema.builder()
+			.field("a", DataTypes.INT())
+			.field("b", DataTypes.STRING())
+			.field("c", DataTypes.BIGINT())
+			.primaryKey("a", "d")
+			.build();
+	}
+
+	@Test
+	public void testInvalidPrimaryKeyNestedFieldName() {
+		thrown.expectMessage(
+			"The primary key field 'c.q1' is not existed in the schema");
+		TableSchema.builder()
+			.field("a", DataTypes.INT())
+			.field("b", DataTypes.STRING())
+			.field("c", DataTypes.ROW(
+				DataTypes.FIELD("q1", DataTypes.STRING()),
+				DataTypes.FIELD("q2", DataTypes.TIMESTAMP(3))))
+			.primaryKey("b", "c.q1")
+			.build();
+	}
+
+	@Test
+	public void testInvalidMultiPrimaryKey() {
+		thrown.expectMessage(
+			"A primary key [a] have been defined, can not define another primary key [b]");
+		TableSchema.builder()
+			.field("a", DataTypes.INT())
+			.field("b", DataTypes.STRING())
+			.field("c", DataTypes.BIGINT())
+			.primaryKey("a")
+			.primaryKey("b")
+			.build();
+	}
+
+	@Test
+	public void testInvalidUniqueKeyFieldName() {
+		thrown.expectMessage("The unique key field 'd' is not existed in the schema");
 
 Review comment:
   ```suggestion
   		thrown.expectMessage("The unique key field 'd' does not exist in the schema");
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message