ygerzhedovich commented on a change in pull request #711:
URL: https://github.com/apache/ignite-3/pull/711#discussion_r824661601
##########
File path:
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCreateTableDdlTest.java
##########
@@ -42,16 +66,63 @@ public void pkWithNullableColumns() {
@Test
public void undefinedColumnsInPrimaryKey() {
- assertThrows(
- IgniteException.class,
- () -> sql("CREATE TABLE T0(ID INT, VAL INT, PRIMARY KEY (ID1,
ID0, ID2))"),
- " Primary key constrain contains undefined columns:
[cols=[ID0, ID2, ID1]]"
+ assertThat(
+ assertThrows(
+ IgniteException.class,
+ () -> sql("CREATE TABLE T0(ID INT, VAL INT, PRIMARY
KEY (ID1, ID0, ID2))")
+ ).getMessage(),
+ containsString("Primary key constrain contains undefined
columns: [cols=[ID0, ID2, ID1]]")
);
}
+ /**
+ * Check invalid colocation columns configuration:
+ * - not PK columns;
+ * - duplicates colocation columns.
+ */
@Test
- public void dbg() {
- sql("CREATE TABLE T0(ID INT, VAL INT, PRIMARY KEY (ID))");
+ public void invalidColocationColumns() {
+ assertThat(
+ assertThrows(
+ IgniteException.class,
+ () -> sql("CREATE TABLE T0(ID0 INT, ID1 INT, VAL INT,
PRIMARY KEY (ID1, ID0)) COLOCATE (ID0, VAL)")
+ ).getMessage(),
+ containsString("Schema definition error: All colocation
columns must be part of primary key")
+ );
+
+ assertThat(
+ assertThrows(
+ IgniteException.class,
+ () -> sql("CREATE TABLE T0(ID0 INT, ID1 INT, VAL INT,
PRIMARY KEY (ID1, ID0)) COLOCATE (ID1, ID0, ID1)")
Review comment:
I think it's ok, let's keep 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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]