korlov42 commented on a change in pull request #711:
URL: https://github.com/apache/ignite-3/pull/711#discussion_r826120640



##########
File path: 
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/sql/SqlDdlParserTest.java
##########
@@ -214,6 +217,52 @@ public void createTableWithOptions() throws 
SqlParseException {
         
assertThatIntegerOptionPresent(createTable.createOptionList().getList(), 
"PARTITIONS", 3);
     }
 
+    /**
+     * Parsing of CREATE TABLE with specified colocation columns.
+     */
+    @Test
+    public void createTableWithColocation() throws SqlParseException {
+        IgniteSqlCreateTable createTable;
+
+        createTable = parseCreateTable(
+                "CREATE TABLE MY_TABLE(ID0 INT, ID1 INT, ID2 INT, VAL INT, 
PRIMARY KEY (ID0, ID1, ID2))"
+        );
+
+        assertNull(createTable.colocationColumns());
+
+        createTable = parseCreateTable(
+                "CREATE TABLE MY_TABLE(ID0 INT, ID1 INT, ID2 INT, VAL INT, 
PRIMARY KEY (ID0, ID1, ID2)) COLOCATE BY (ID2, ID1)"
+        );
+
+        assertThat(
+                createTable.colocationColumns().getList().stream()
+                .map(SqlIdentifier.class::cast)
+                .map(SqlIdentifier::getSimple)
+                .collect(Collectors.toList()),
+                equalTo(List.of("ID2", "ID1"))
+        );
+
+        createTable = parseCreateTable(
+                "CREATE TABLE MY_TABLE(ID0 INT, ID1 INT, ID2 INT, VAL INT, 
PRIMARY KEY (ID0, ID1, ID2)) COLOCATE (ID0)"
+        );
+
+        assertThat(

Review comment:
       Let's add a few test cases with `WITH` clause




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


Reply via email to