You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ygerzhedovich (via GitHub)" <gi...@apache.org> on 2024/10/18 14:58:49 UTC

[PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

ygerzhedovich opened a new pull request, #4599:
URL: https://github.com/apache/ignite-3/pull/4599

   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599#discussion_r1810592466


##########
docs/_docs/sql-reference/grammar-reference.adoc:
##########
@@ -180,38 +180,25 @@ Referenced by:
 
 '''
 
-== parameter

Review Comment:
   this section is referenced by zone-related ddl's



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599#discussion_r1808938740


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlCreateTable.java:
##########
@@ -49,33 +49,37 @@ protected Operator(boolean existFlag) {
         public SqlCall createCall(@Nullable SqlLiteral functionQualifier, SqlParserPos pos,
                 @Nullable SqlNode... operands) {
             return new IgniteSqlCreateTable(pos, existFlag(), (SqlIdentifier) operands[0], (SqlNodeList) operands[1],
-                    (SqlNodeList) operands[2], (SqlNodeList) operands[3]);
+                    (SqlNodeList) operands[2], (SqlIdentifier) operands[3], (SqlLiteral) operands[4]);
         }
     }
 
     private final SqlIdentifier name;
+    @Nullable

Review Comment:
   yes, fixed



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverterTest.java:
##########
@@ -613,12 +609,12 @@ public Stream<DynamicTest> timestampWithTzWithDefaults() {
 
     @Test
     public void tableWithAutogenPkColumn() throws SqlParseException {
-        var node = parse("CREATE TABLE t (id uuid default rand_uuid primary key, val int) WITH STORAGE_PROFILE='"
+        var node = parse("CREATE TABLE t (id uuid default rand_uuid primary key, val int) STORAGE PROFILE '"

Review Comment:
   fixed



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599#discussion_r1810732120


##########
docs/_docs/sql-reference/grammar-reference.adoc:
##########
@@ -180,38 +180,25 @@ Referenced by:
 
 '''
 
-== parameter

Review Comment:
   yep, forgot to revert it. Thanks for the attention!



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599#discussion_r1808936988


##########
docs/_docs/developers-guide/java-to-tables.adoc:
##########
@@ -82,7 +82,7 @@ The result is equivalent to the following SQL multi-statement:
 
 [source, sql]
 ----
-CREATE ZONE IF NOT EXISTS zone_test ENGINE ROCKSDB WITH PARTITIONS=2;
+CREATE ZONE IF NOT EXISTS ZONE_TEST ENGINE ROCKSDB WITH PARTITIONS=2;

Review Comment:
   ok



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich merged PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599


-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599#discussion_r1808935320


##########
docs/_docs/sql-reference/ddl.adoc:
##########
@@ -97,18 +94,7 @@ CREATE TABLE IF NOT EXISTS Person (
   name varchar,
   age int,
   company varchar
-) WITH PRIMARY_ZONE=`MYZONE`
-----
-
-Creates a Person table where the records expire at timestamps in the `ttl` column:
-
-[source,sql]
-----
-CREATE TABLE IF NOT EXISTS Person ( 
-  id int PRIMARY KEY,
-  name varchar,
-  ttl timestamp
-) EXPIRE AT ttl
+) ZONE=`MYZONE`

Review Comment:
   sign `=` will be removed anyway )



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599#discussion_r1808858299


##########
docs/_docs/sql-reference/ddl.adoc:
##########
@@ -97,18 +94,7 @@ CREATE TABLE IF NOT EXISTS Person (
   name varchar,
   age int,
   company varchar
-) WITH PRIMARY_ZONE=`MYZONE`
-----
-
-Creates a Person table where the records expire at timestamps in the `ttl` column:
-
-[source,sql]
-----
-CREATE TABLE IF NOT EXISTS Person ( 
-  id int PRIMARY KEY,
-  name varchar,
-  ttl timestamp
-) EXPIRE AT ttl
+) ZONE=`MYZONE`

Review Comment:
   I bet this example won't work



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlIndexScanBenchmark.java:
##########
@@ -92,7 +92,7 @@ public void setUp() throws Exception {
             if (!Files.exists(workDir().resolve(DATASET_READY_MARK_FILE_NAME))) {
                 sql.executeScript(
                         "CREATE ZONE single_partition_zone WITH replicas = 1, partitions = 1;"
-                                + "CREATE TABLE test (id INT PRIMARY KEY, val DATE) WITH primary_zone = single_partition_zone;"
+                                + "CREATE TABLE test (id INT PRIMARY KEY, val DATE) zone single_partition_zone;"

Review Comment:
   ```suggestion
                                   + "CREATE TABLE test (id INT PRIMARY KEY, val DATE) ZONE single_partition_zone;"
   ```



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractMultiNodeBenchmark.java:
##########
@@ -132,7 +132,7 @@ protected static void createTable(String tableName, List<String> columns, List<S
             createTableStatement += "\nCOLOCATE BY (" + String.join(", ", colocationKeys) + ")";
         }
 
-        createTableStatement += "\nWITH primary_zone='" + ZONE_NAME + "'";
+        createTableStatement += "\nzone " + ZONE_NAME;

Review Comment:
   ```suggestion
           createTableStatement += "\nZONE " + ZONE_NAME;
   ```



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/schemasync/ItSchemaSyncMultiNodeTest.java:
##########
@@ -186,7 +186,7 @@ void ddlAfterDdlOnAnotherNodeSeesFirstDdlResults() {
             });
 
             CompletableFuture<Void> tableCreationFuture = runAsync(() -> cluster.doInSession(NODE_1_INDEX, session -> {
-                executeUpdate("CREATE TABLE " + TABLE_NAME + " (id int PRIMARY KEY, val varchar) WITH primary_zone='TEST_ZONE'", session);
+                executeUpdate("CREATE TABLE " + TABLE_NAME + " (id int PRIMARY KEY, val varchar) zone TEST_ZONE", session);

Review Comment:
   ```suggestion
                   executeUpdate("CREATE TABLE " + TABLE_NAME + " (id int PRIMARY KEY, val varchar) ZONE TEST_ZONE", session);
   ```



##########
docs/_docs/developers-guide/java-to-tables.adoc:
##########
@@ -82,7 +82,7 @@ The result is equivalent to the following SQL multi-statement:
 
 [source, sql]
 ----
-CREATE ZONE IF NOT EXISTS zone_test ENGINE ROCKSDB WITH PARTITIONS=2;
+CREATE ZONE IF NOT EXISTS ZONE_TEST ENGINE ROCKSDB WITH PARTITIONS=2;

Review Comment:
   I would leave it in lower case to not mix with keywords



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverterTest.java:
##########
@@ -613,12 +609,12 @@ public Stream<DynamicTest> timestampWithTzWithDefaults() {
 
     @Test
     public void tableWithAutogenPkColumn() throws SqlParseException {
-        var node = parse("CREATE TABLE t (id uuid default rand_uuid primary key, val int) WITH STORAGE_PROFILE='"
+        var node = parse("CREATE TABLE t (id uuid default rand_uuid primary key, val int) STORAGE PROFILE '"

Review Comment:
   `var` is not allowed in this context 



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlCreateTable.java:
##########
@@ -49,33 +49,37 @@ protected Operator(boolean existFlag) {
         public SqlCall createCall(@Nullable SqlLiteral functionQualifier, SqlParserPos pos,
                 @Nullable SqlNode... operands) {
             return new IgniteSqlCreateTable(pos, existFlag(), (SqlIdentifier) operands[0], (SqlNodeList) operands[1],
-                    (SqlNodeList) operands[2], (SqlNodeList) operands[3]);
+                    (SqlNodeList) operands[2], (SqlIdentifier) operands[3], (SqlLiteral) operands[4]);
         }
     }
 
     private final SqlIdentifier name;
+    @Nullable

Review Comment:
   annotation seems to be misplaced



##########
modules/catalog/src/integrationTest/java/org/apache/ignite/internal/catalog/it/ItConcurrentDdlsTest.java:
##########
@@ -62,7 +62,7 @@ private void createTablesInParallel() {
             String tableName = "TEST" + n;
 
             node(0).sql().executeScript(
-                    "CREATE TABLE " + tableName + " (id INT PRIMARY KEY, val VARCHAR) WITH primary_zone='" + ZONE_NAME + "'"
+                    "CREATE TABLE " + tableName + " (id INT PRIMARY KEY, val VARCHAR) zone " + ZONE_NAME

Review Comment:
   ```suggestion
                       "CREATE TABLE " + tableName + " (id INT PRIMARY KEY, val VARCHAR) ZONE " + ZONE_NAME
   ```
   



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java:
##########
@@ -1758,7 +1757,7 @@ public void tableRecoveryOnMultipleRestartingNodes(int nodeThatWrittenAssignment
         nodeInhibitor2.startInhibit();
 
         sql.executeAsync(null, "CREATE TABLE " + tableName
-                + "(id INT PRIMARY KEY, name VARCHAR) WITH PRIMARY_ZONE='" + zoneName + "';");
+                + "(id INT PRIMARY KEY, name VARCHAR) ZONE" + zoneName + ";");

Review Comment:
   missed space after ZONE keyword



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599#discussion_r1808934458


##########
docs/_docs/sql-reference/ddl.adoc:
##########
@@ -97,18 +94,7 @@ CREATE TABLE IF NOT EXISTS Person (
   name varchar,
   age int,
   company varchar
-) WITH PRIMARY_ZONE=`MYZONE`
-----
-
-Creates a Person table where the records expire at timestamps in the `ttl` column:
-
-[source,sql]
-----
-CREATE TABLE IF NOT EXISTS Person ( 
-  id int PRIMARY KEY,
-  name varchar,
-  ttl timestamp
-) EXPIRE AT ttl
+) ZONE=`MYZONE`

Review Comment:
   agree, the the current state of documentation is bad requiring total rework. But in the patch I just removed use old syntax.



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599#discussion_r1808938105


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/SqlIndexScanBenchmark.java:
##########
@@ -92,7 +92,7 @@ public void setUp() throws Exception {
             if (!Files.exists(workDir().resolve(DATASET_READY_MARK_FILE_NAME))) {
                 sql.executeScript(
                         "CREATE ZONE single_partition_zone WITH replicas = 1, partitions = 1;"
-                                + "CREATE TABLE test (id INT PRIMARY KEY, val DATE) WITH primary_zone = single_partition_zone;"
+                                + "CREATE TABLE test (id INT PRIMARY KEY, val DATE) zone single_partition_zone;"

Review Comment:
   fixed



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java:
##########
@@ -1758,7 +1757,7 @@ public void tableRecoveryOnMultipleRestartingNodes(int nodeThatWrittenAssignment
         nodeInhibitor2.startInhibit();
 
         sql.executeAsync(null, "CREATE TABLE " + tableName
-                + "(id INT PRIMARY KEY, name VARCHAR) WITH PRIMARY_ZONE='" + zoneName + "';");
+                + "(id INT PRIMARY KEY, name VARCHAR) ZONE" + zoneName + ";");

Review Comment:
   fixed



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/schemasync/ItSchemaSyncMultiNodeTest.java:
##########
@@ -186,7 +186,7 @@ void ddlAfterDdlOnAnotherNodeSeesFirstDdlResults() {
             });
 
             CompletableFuture<Void> tableCreationFuture = runAsync(() -> cluster.doInSession(NODE_1_INDEX, session -> {
-                executeUpdate("CREATE TABLE " + TABLE_NAME + " (id int PRIMARY KEY, val varchar) WITH primary_zone='TEST_ZONE'", session);
+                executeUpdate("CREATE TABLE " + TABLE_NAME + " (id int PRIMARY KEY, val varchar) zone TEST_ZONE", session);

Review Comment:
   fixed



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-23353 Improve CREATE TABLE syntax [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #4599:
URL: https://github.com/apache/ignite-3/pull/4599#discussion_r1808937471


##########
modules/catalog/src/integrationTest/java/org/apache/ignite/internal/catalog/it/ItConcurrentDdlsTest.java:
##########
@@ -62,7 +62,7 @@ private void createTablesInParallel() {
             String tableName = "TEST" + n;
 
             node(0).sql().executeScript(
-                    "CREATE TABLE " + tableName + " (id INT PRIMARY KEY, val VARCHAR) WITH primary_zone='" + ZONE_NAME + "'"
+                    "CREATE TABLE " + tableName + " (id INT PRIMARY KEY, val VARCHAR) zone " + ZONE_NAME

Review Comment:
   fixed



##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractMultiNodeBenchmark.java:
##########
@@ -132,7 +132,7 @@ protected static void createTable(String tableName, List<String> columns, List<S
             createTableStatement += "\nCOLOCATE BY (" + String.join(", ", colocationKeys) + ")";
         }
 
-        createTableStatement += "\nWITH primary_zone='" + ZONE_NAME + "'";
+        createTableStatement += "\nzone " + ZONE_NAME;

Review Comment:
   fixed



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org