You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2023/06/02 11:08:56 UTC

[ignite-3] branch ignite-19611-1 created (now c0eb9dbffe)

This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a change to branch ignite-19611-1
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


      at c0eb9dbffe Drop dead code.

This branch includes the following new commits:

     new c0eb9dbffe Drop dead code.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[ignite-3] 01/01: Drop dead code.

Posted by am...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a commit to branch ignite-19611-1
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit c0eb9dbffe431fb1411a8168caedd899f9064d9c
Author: amashenkov <an...@gmail.com>
AuthorDate: Fri Jun 2 14:04:47 2023 +0300

    Drop dead code.
---
 .../commands/AbstractTableCommandParams.java       |  21 ----
 .../internal/catalog/CatalogServiceSelfTest.java   | 111 ++++-----------------
 .../exec/ddl/DdlToCatalogCommandConverter.java     |   4 -
 3 files changed, 17 insertions(+), 119 deletions(-)

diff --git a/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/AbstractTableCommandParams.java b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/AbstractTableCommandParams.java
index 0aa2b8ecfc..60414181f5 100644
--- a/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/AbstractTableCommandParams.java
+++ b/modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/AbstractTableCommandParams.java
@@ -24,9 +24,6 @@ public class AbstractTableCommandParams implements DdlCommandParams {
     /** Table name. */
     protected String tableName;
 
-    /** Quietly ignore this command if table is not exists. */
-    protected boolean ifTableExists;
-
     /** Schema name where this new table will be created. */
     protected String schema;
 
@@ -38,13 +35,6 @@ public class AbstractTableCommandParams implements DdlCommandParams {
         return schema;
     }
 
-    /**
-     * Quietly ignore if table is not exist.
-     */
-    public boolean ifTableExists() {
-        return ifTableExists;
-    }
-
     /**
      * Parameters builder.
      */
@@ -77,17 +67,6 @@ public class AbstractTableCommandParams implements DdlCommandParams {
             return (BuilderT) this;
         }
 
-        /**
-         * Set quietly ignore flag.
-         *
-         * @param ifTableNotExists Flag.
-         */
-        public BuilderT ifTableExists(boolean ifTableNotExists) {
-            params.ifTableExists = ifTableNotExists;
-
-            return (BuilderT) this;
-        }
-
         /**
          * Builds parameters.
          *
diff --git a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogServiceSelfTest.java b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogServiceSelfTest.java
index a2353ae015..08c1e3c699 100644
--- a/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogServiceSelfTest.java
+++ b/modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogServiceSelfTest.java
@@ -147,7 +147,6 @@ public class CatalogServiceSelfTest {
         CreateTableParams params = CreateTableParams.builder()
                 .schemaName(SCHEMA_NAME)
                 .tableName(TABLE_NAME)
-                .ifTableExists(true)
                 .zone(ZONE_NAME)
                 .columns(List.of(
                         ColumnParams.builder().name("key1").type(ColumnType.INT32).build(),
@@ -197,9 +196,7 @@ public class CatalogServiceSelfTest {
         assertEquals(0L, table.zoneId());
 
         // Validate another table creation.
-        fut = service.createTable(simpleTable(TABLE_NAME_2));
-
-        assertThat(fut, willBe((Object) null));
+        assertThat(service.createTable(simpleTable(TABLE_NAME_2)), willBe((Object) null));
 
         // Validate actual catalog has both tables.
         schema = service.schema(2);
@@ -217,35 +214,12 @@ public class CatalogServiceSelfTest {
         assertSame(schema.table(TABLE_NAME_2), service.table(2, System.currentTimeMillis()));
 
         assertNotSame(schema.table(TABLE_NAME), schema.table(TABLE_NAME_2));
-    }
 
-    @Test
-    public void testCreateTableIfExistsFlag() {
-        CreateTableParams params = CreateTableParams.builder()
-                .tableName(TABLE_NAME)
-                .columns(List.of(
-                        ColumnParams.builder().name("key").type(ColumnType.INT32).build(),
-                        ColumnParams.builder().name("val").type(ColumnType.INT32).build()
-                ))
-                .primaryKeyColumns(List.of("key"))
-                .ifTableExists(true)
-                .build();
+        // Try to create another table with same name.
+        assertThat(service.createTable(simpleTable(TABLE_NAME_2)), willThrowFast(TableAlreadyExistsException.class));
 
-        assertThat(service.createTable(params), willBe((Object) null));
-        assertThat(service.createTable(params), willThrowFast(TableAlreadyExistsException.class));
-
-        CompletableFuture<?> fut = service.createTable(
-                CreateTableParams.builder()
-                        .tableName(TABLE_NAME)
-                        .columns(List.of(
-                                ColumnParams.builder().name("key").type(ColumnType.INT32).build(),
-                                ColumnParams.builder().name("val").type(ColumnType.INT32).build()
-                        ))
-                        .primaryKeyColumns(List.of("key"))
-                        .ifTableExists(false)
-                        .build());
-
-        assertThat(fut, willThrowFast(TableAlreadyExistsException.class));
+        // Validate schema wasn't changed.
+        assertSame(schema, service.activeSchema(System.currentTimeMillis()));
     }
 
     @Test
@@ -291,38 +265,12 @@ public class CatalogServiceSelfTest {
 
         assertSame(schema.table(TABLE_NAME_2), service.table(TABLE_NAME_2, System.currentTimeMillis()));
         assertSame(schema.table(TABLE_NAME_2), service.table(2, System.currentTimeMillis()));
-    }
-
-    @Test
-    public void testDropTableIfExistsFlag() {
-        CreateTableParams createTableParams = CreateTableParams.builder()
-                .schemaName(SCHEMA_NAME)
-                .tableName(TABLE_NAME)
-                .columns(List.of(
-                        ColumnParams.builder().name("key").type(ColumnType.INT32).build(),
-                        ColumnParams.builder().name("val").type(ColumnType.INT32).build()
-                ))
-                .primaryKeyColumns(List.of("key"))
-                .build();
-
-        assertThat(service.createTable(createTableParams), willBe((Object) null));
 
-        DropTableParams params = DropTableParams.builder()
-                .schemaName(SCHEMA_NAME)
-                .tableName(TABLE_NAME)
-                .ifTableExists(true)
-                .build();
-
-        assertThat(service.dropTable(params), willBe((Object) null));
-        assertThat(service.dropTable(params), willThrowFast(TableNotFoundException.class));
-
-        params = DropTableParams.builder()
-                .schemaName(SCHEMA_NAME)
-                .tableName(TABLE_NAME)
-                .ifTableExists(false)
-                .build();
+        // Try to drop table once again.
+        assertThat(service.dropTable(dropTableParams), willThrowFast(TableNotFoundException.class));
 
-        assertThat(service.dropTable(params), willThrowFast(TableNotFoundException.class));
+        // Validate schema wasn't changed.
+        assertSame(schema, service.activeSchema(System.currentTimeMillis()));
     }
 
     @Test
@@ -407,26 +355,26 @@ public class CatalogServiceSelfTest {
     }
 
     @Test
-    public void testDropColumnIfTableExistsFlag() {
+    public void testCreateDropColumnIfTableNotExists() {
         assertNull(service.table(TABLE_NAME, System.currentTimeMillis()));
 
-        AlterTableAddColumnParams params = AlterTableAddColumnParams.builder()
+        // Try to add a new column.
+        AlterTableAddColumnParams addColumnParams = AlterTableAddColumnParams.builder()
                 .schemaName(SCHEMA_NAME)
                 .tableName(TABLE_NAME)
                 .columns(List.of(ColumnParams.builder().name(NEW_COLUMN_NAME).type(ColumnType.INT32).nullable(true).build()))
-                .ifTableExists(false)
                 .build();
 
-        assertThat(service.addColumn(params), willThrow(TableNotFoundException.class));
+        assertThat(service.addColumn(addColumnParams), willThrow(TableNotFoundException.class));
 
-        params = AlterTableAddColumnParams.builder()
+        // Try to drop column.
+        AlterTableDropColumnParams dropColumnParams = AlterTableDropColumnParams.builder()
                 .schemaName(SCHEMA_NAME)
                 .tableName(TABLE_NAME)
-                .columns(List.of(ColumnParams.builder().name(NEW_COLUMN_NAME).type(ColumnType.INT32).nullable(true).build()))
-                .ifTableExists(true)
+                .columns(Set.of("VAL"))
                 .build();
 
-        assertThat(service.addColumn(params), willThrow(TableNotFoundException.class));
+        assertThat(service.dropColumn(dropColumnParams), willThrow(TableNotFoundException.class));
     }
 
     @Test
@@ -463,29 +411,6 @@ public class CatalogServiceSelfTest {
         assertNotNull(schema.table(TABLE_NAME).column("VAL"));
     }
 
-    @Test
-    public void testAddColumnIfTableExistsFlag() {
-        assertNull(service.table(TABLE_NAME, System.currentTimeMillis()));
-
-        AlterTableAddColumnParams params = AlterTableAddColumnParams.builder()
-                .schemaName(SCHEMA_NAME)
-                .tableName(TABLE_NAME)
-                .columns(List.of(ColumnParams.builder().name(NEW_COLUMN_NAME).type(ColumnType.INT32).nullable(true).build()))
-                .ifTableExists(false)
-                .build();
-
-        assertThat(service.addColumn(params), willThrow(TableNotFoundException.class));
-
-        params = AlterTableAddColumnParams.builder()
-                .schemaName(SCHEMA_NAME)
-                .tableName(TABLE_NAME)
-                .columns(List.of(ColumnParams.builder().name(NEW_COLUMN_NAME).type(ColumnType.INT32).nullable(true).build()))
-                .ifTableExists(true)
-                .build();
-
-        assertThat(service.addColumn(params), willThrow(TableNotFoundException.class));
-    }
-
     @Test
     public void testAddDropMultipleColumns() {
         assertThat(service.createTable(simpleTable(TABLE_NAME)), willBe((Object) null));
@@ -610,7 +535,6 @@ public class CatalogServiceSelfTest {
         CreateTableParams params = CreateTableParams.builder()
                 .schemaName(SCHEMA_NAME)
                 .tableName(TABLE_NAME)
-                .ifTableExists(true)
                 .zone(ZONE_NAME)
                 .columns(List.of(
                         ColumnParams.builder().name("key1").type(ColumnType.INT32).build(),
@@ -655,7 +579,6 @@ public class CatalogServiceSelfTest {
                         .nullable(true)
                         .build()
                 ))
-                .ifTableExists(true)
                 .build();
 
         AlterTableDropColumnParams dropColumnParams = AlterTableDropColumnParams.builder()
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlToCatalogCommandConverter.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlToCatalogCommandConverter.java
index 07f875b872..fadf9ec4fe 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlToCatalogCommandConverter.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlToCatalogCommandConverter.java
@@ -43,7 +43,6 @@ class DdlToCatalogCommandConverter {
         return CreateTableParams.builder()
                 .schemaName(cmd.schemaName())
                 .tableName(cmd.tableName())
-                .ifTableExists(cmd.ifTableExists())
 
                 .columns(columns)
                 .colocationColumns(cmd.colocationColumns())
@@ -58,7 +57,6 @@ class DdlToCatalogCommandConverter {
         return DropTableParams.builder()
                 .schemaName(cmd.schemaName())
                 .tableName(cmd.tableName())
-                .ifTableExists(cmd.ifTableExists())
                 .build();
     }
 
@@ -68,7 +66,6 @@ class DdlToCatalogCommandConverter {
         return AlterTableAddColumnParams.builder()
                 .schemaName(cmd.schemaName())
                 .tableName(cmd.tableName())
-                .ifTableExists(cmd.ifTableExists())
 
                 .columns(columns)
 
@@ -79,7 +76,6 @@ class DdlToCatalogCommandConverter {
         return AlterTableDropColumnParams.builder()
                 .schemaName(cmd.schemaName())
                 .tableName(cmd.tableName())
-                .ifTableExists(cmd.ifTableExists())
 
                 .columns(cmd.columns())