You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by zs...@apache.org on 2023/07/06 06:05:48 UTC
[ignite-3] branch main updated: IGNITE-19644 Change DROP|ADD COLUMN IF (NOT) EXISTS syntax (#2275)
This is an automated email from the ASF dual-hosted git repository.
zstan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 2f66837a6f IGNITE-19644 Change DROP|ADD COLUMN IF (NOT) EXISTS syntax (#2275)
2f66837a6f is described below
commit 2f66837a6fdef68a9e14128245128f33f8ea59d0
Author: Evgeniy Stanilovskiy <st...@gmail.com>
AuthorDate: Thu Jul 6 09:05:44 2023 +0300
IGNITE-19644 Change DROP|ADD COLUMN IF (NOT) EXISTS syntax (#2275)
---
.../internal/sql/api/ItSqlAsynchronousApiTest.java | 2 +
.../internal/sql/engine/ItCreateTableDdlTest.java | 64 +++++++++++
.../internal/sql/internal/InternalSchemaTest.java | 125 ---------------------
.../src/main/codegen/includes/parserImpls.ftl | 8 +-
.../sql/engine/exec/ddl/DdlCommandHandler.java | 46 +++-----
.../engine/prepare/ddl/AlterTableAddCommand.java | 11 --
.../engine/prepare/ddl/AlterTableDropCommand.java | 21 ----
.../prepare/ddl/DdlSqlToCommandConverter.java | 2 -
.../engine/sql/IgniteSqlAlterTableAddColumn.java | 15 +--
.../engine/sql/IgniteSqlAlterTableDropColumn.java | 21 +---
10 files changed, 86 insertions(+), 229 deletions(-)
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java
index c2c0b0a656..eb0af9141e 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java
@@ -540,6 +540,8 @@ public class ItSqlAsynchronousApiTest extends ClusterPerClassIntegrationTest {
assertEquals(-1, r.columnIndex("notExistColumn"));
assertEquals(1, r.intValue("COL_A"));
+ // Unmute after https://issues.apache.org/jira/browse/IGNITE-19894
+ //assertEquals(1, r.intValue("COL_a"));
assertEquals(2, r.intValue("COL_B"));
assertThrowsWithCause(
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCreateTableDdlTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCreateTableDdlTest.java
index e7a54f0552..7237f5267b 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCreateTableDdlTest.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCreateTableDdlTest.java
@@ -21,10 +21,17 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
+import java.util.List;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.configuration.ConfigurationManager;
import org.apache.ignite.internal.schema.Column;
+import org.apache.ignite.internal.schema.configuration.ExtendedTableView;
+import org.apache.ignite.internal.schema.configuration.TablesConfiguration;
import org.apache.ignite.internal.table.TableImpl;
+import org.apache.ignite.internal.testframework.IgniteTestUtils;
import org.apache.ignite.lang.IgniteException;
import org.apache.ignite.sql.SqlException;
import org.junit.jupiter.api.AfterEach;
@@ -122,6 +129,63 @@ public class ItCreateTableDdlTest extends ClusterPerClassIntegrationTest {
assertEquals("ID0", colocationColumns[1].name());
}
+ /** Test correct mapping schema after alter columns. */
+ @Test
+ public void testDropAndAddColumns() {
+ sql("CREATE TABLE my (c1 INT PRIMARY KEY, c2 INT, c3 VARCHAR)");
+
+ sql("INSERT INTO my VALUES (1, 2, '3')");
+
+ List<List<Object>> res = sql("SELECT c1, c3 FROM my");
+
+ assertFalse(res.isEmpty());
+
+ sql("ALTER TABLE my DROP COLUMN c2");
+
+ res = sql("SELECT c1, c3 FROM my");
+
+ assertFalse(res.isEmpty());
+
+ sql("ALTER TABLE my ADD COLUMN (c2 INT, c4 VARCHAR)");
+
+ sql("INSERT INTO my VALUES (2, '2', 2, '3')");
+
+ res = sql("SELECT c2, c4 FROM my WHERE c1=2");
+
+ assertEquals(2, res.get(0).get(0));
+
+ sql("ALTER TABLE my DROP COLUMN c4");
+ sql("ALTER TABLE my ADD COLUMN (c4 INT)");
+ sql("INSERT INTO my VALUES (3, '2', 3, 3)");
+
+ res = sql("SELECT c4 FROM my WHERE c1=3");
+
+ assertEquals(3, res.get(0).get(0));
+ }
+
+ /**
+ * Checks that schema version is updated even if column names are intersected.
+ */
+ // Need to be removed after https://issues.apache.org/jira/browse/IGNITE-19082
+ @Test
+ public void checkSchemaUpdatedWithEqAlterColumn() {
+ sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
+
+ Ignite node = CLUSTER_NODES.get(0);
+
+ ConfigurationManager cfgMgr = IgniteTestUtils.getFieldValue(node, "clusterCfgMgr");
+
+ TablesConfiguration tablesConfiguration = cfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY);
+
+ int schIdBefore = ((ExtendedTableView) tablesConfiguration.tables().get("TEST").value()).schemaId();
+
+ sql("ALTER TABLE TEST ADD COLUMN (VAL1 INT)");
+
+ int schIdAfter = ((ExtendedTableView) tablesConfiguration.tables().get("TEST").value()).schemaId();
+
+ assertEquals(schIdBefore + 1, schIdAfter);
+ }
+
/**
* Check explicit colocation columns configuration.
*/
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/internal/InternalSchemaTest.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/internal/InternalSchemaTest.java
deleted file mode 100644
index 4507ca8d6e..0000000000
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/internal/InternalSchemaTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.sql.internal;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.apache.ignite.Ignite;
-import org.apache.ignite.internal.configuration.ConfigurationManager;
-import org.apache.ignite.internal.schema.configuration.ExtendedTableView;
-import org.apache.ignite.internal.schema.configuration.TablesConfiguration;
-import org.apache.ignite.internal.sql.engine.ClusterPerClassIntegrationTest;
-import org.apache.ignite.internal.testframework.IgniteTestUtils;
-import org.apache.ignite.sql.IgniteSql;
-import org.apache.ignite.sql.ResultSet;
-import org.apache.ignite.sql.Session;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-
-/** Tests for internal manipulations with schema. */
-public class InternalSchemaTest extends ClusterPerClassIntegrationTest {
- /**
- * Checks that schema version is updated even if column names are intersected.
- */
- @Disabled("https://issues.apache.org/jira/browse/IGNITE-19612")
- @Test
- public void checkSchemaUpdatedWithEqAlterColumn() {
- IgniteSql sql = igniteSql();
- Session ses = sql.createSession();
-
- checkDdl(true, ses, "CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
-
- Ignite node = CLUSTER_NODES.get(0);
-
- ConfigurationManager cfgMgr = IgniteTestUtils.getFieldValue(node, "clusterCfgMgr");
-
- final TablesConfiguration tablesConfiguration = cfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY);
-
- int schIdBefore = ((ExtendedTableView) tablesConfiguration.tables().get("TEST").value()).schemaId();
-
- checkDdl(false, ses, "ALTER TABLE TEST ADD COLUMN IF NOT EXISTS (VAL0 INT, VAL1 INT)");
-
- int schIdAfter = ((ExtendedTableView) tablesConfiguration.tables().get("TEST").value()).schemaId();
-
- assertEquals(schIdBefore + 1, schIdAfter);
- }
-
- /** Test correct mapping schema after drop columns. */
- @Test
- public void testDropColumns() {
- IgniteSql sql = igniteSql();
- Session ses = sql.createSession();
-
- checkDdl(true, ses, "CREATE TABLE my (c1 INT PRIMARY KEY, c2 INT, c3 VARCHAR)");
-
- ses.execute(
- null,
- "INSERT INTO my VALUES (1, 2, '3')"
- );
-
- ResultSet res = ses.execute(
- null,
- "SELECT c1, c3 FROM my"
- );
-
- assertTrue(res.hasNext());
-
- checkDdl(true, ses, "ALTER TABLE my DROP COLUMN c2");
-
- res = ses.execute(
- null,
- "SELECT c1, c3 FROM my"
- );
-
- assertNotNull(res.next());
-
- checkDdl(true, ses, "ALTER TABLE my ADD COLUMN (c2 INT, c4 VARCHAR)");
-
- res = ses.execute(
- null,
- "SELECT c1, c3 FROM my"
- );
-
- assertNotNull(res.next());
- }
-
- private static void checkDdl(boolean expectedApplied, Session ses, String sql) {
- ResultSet res = ses.execute(
- null,
- sql
- );
-
- assertEquals(expectedApplied, res.wasApplied());
- assertFalse(res.hasRowSet());
- assertEquals(-1, res.affectedRows());
-
- res.close();
- }
-
- /**
- * Gets the SQL API.
- *
- * @return SQL API.
- */
- protected IgniteSql igniteSql() {
- return CLUSTER_NODES.get(0).sql();
- }
-}
diff --git a/modules/sql-engine/src/main/codegen/includes/parserImpls.ftl b/modules/sql-engine/src/main/codegen/includes/parserImpls.ftl
index 058e79491d..9a83b796f2 100644
--- a/modules/sql-engine/src/main/codegen/includes/parserImpls.ftl
+++ b/modules/sql-engine/src/main/codegen/includes/parserImpls.ftl
@@ -417,12 +417,12 @@ SqlNode SqlAlterTable() :
<ALTER> { s = span(); }
<TABLE> ifExists = IfExistsOpt() id = CompoundIdentifier()
(
- <ADD> [<COLUMN>] colIgnoreErr = IfNotExistsOpt() cols = ColumnWithTypeOrList() {
- return new IgniteSqlAlterTableAddColumn(s.end(this), ifExists, id, colIgnoreErr, cols);
+ <ADD> [<COLUMN>] cols = ColumnWithTypeOrList() {
+ return new IgniteSqlAlterTableAddColumn(s.end(this), ifExists, id, cols);
}
|
- <DROP> [<COLUMN>] colIgnoreErr = IfExistsOpt() cols = SimpleIdentifierOrList() {
- return new IgniteSqlAlterTableDropColumn(s.end(this), ifExists, id, colIgnoreErr, cols);
+ <DROP> [<COLUMN>] cols = SimpleIdentifierOrList() {
+ return new IgniteSqlAlterTableDropColumn(s.end(this), ifExists, id, cols);
}
|
<ALTER> [<COLUMN>] {
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlCommandHandler.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlCommandHandler.java
index 8f8b0b6b6d..01f4262f4d 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlCommandHandler.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ddl/DdlCommandHandler.java
@@ -314,7 +314,7 @@ public class DdlCommandHandler {
return completedFuture(Boolean.FALSE);
}
- return addColumnInternal(cmd.tableName(), cmd.columns(), cmd.ifColumnNotExists())
+ return addColumnInternal(cmd.tableName(), cmd.columns())
.handle(handleModificationResult(cmd.ifTableExists(), TableNotFoundException.class));
}
@@ -324,7 +324,7 @@ public class DdlCommandHandler {
return completedFuture(Boolean.FALSE);
}
- return dropColumnInternal(cmd.tableName(), cmd.columns(), cmd.ifColumnExists())
+ return dropColumnInternal(cmd.tableName(), cmd.columns())
.handle(handleModificationResult(cmd.ifTableExists(), TableNotFoundException.class));
}
@@ -414,10 +414,9 @@ public class DdlCommandHandler {
*
* @param fullName Table with schema name.
* @param colsDef Columns defenitions.
- * @param ignoreColumnExistance Flag indicates exceptionally behavior in case of already existing column.
* @return {@code true} if the full columns set is applied successfully. Otherwise, returns {@code false}.
*/
- private CompletableFuture<Boolean> addColumnInternal(String fullName, List<ColumnDefinition> colsDef, boolean ignoreColumnExistance) {
+ private CompletableFuture<Boolean> addColumnInternal(String fullName, List<ColumnDefinition> colsDef) {
AtomicBoolean retUsr = new AtomicBoolean(true);
return tableManager.alterTableAsync(
@@ -430,34 +429,18 @@ public class DdlCommandHandler {
Set<String> colNamesToOrders = columnNames(chng.columns());
- List<ColumnDefinition> colsDef0;
-
- if (ignoreColumnExistance) {
- colsDef0 = colsDef.stream().filter(k -> {
- if (colNamesToOrders.contains(k.name())) {
- retUsr.set(false);
-
- return false;
- } else {
- return true;
- }
- }).collect(Collectors.toList());
- } else {
- colsDef.stream()
- .filter(k -> colNamesToOrders.contains(k.name()))
- .findAny()
- .ifPresent(c -> {
- throw new ColumnAlreadyExistsException(c.name());
- });
-
- colsDef0 = colsDef;
- }
+ colsDef.stream()
+ .filter(k -> colNamesToOrders.contains(k.name()))
+ .findAny()
+ .ifPresent(c -> {
+ throw new ColumnAlreadyExistsException(c.name());
+ });
- for (ColumnDefinition col : colsDef0) {
+ for (ColumnDefinition col : colsDef) {
cols.create(col.name(), colChg -> convertColumnDefinition(col, colChg));
}
- retTbl.set(!colsDef0.isEmpty());
+ retTbl.set(!colsDef.isEmpty());
});
return retTbl.get();
@@ -504,10 +487,9 @@ public class DdlCommandHandler {
*
* @param tableName Table name.
* @param colNames Columns definitions.
- * @param ignoreColumnExistence Flag indicates exceptionally behavior in case of already existing column.
* @return {@code true} if the full columns set is applied successfully. Otherwise, returns {@code false}.
*/
- private CompletableFuture<Boolean> dropColumnInternal(String tableName, Set<String> colNames, boolean ignoreColumnExistence) {
+ private CompletableFuture<Boolean> dropColumnInternal(String tableName, Set<String> colNames) {
AtomicBoolean ret = new AtomicBoolean(true);
return tableManager.alterTableAsync(
@@ -530,9 +512,7 @@ public class DdlCommandHandler {
if (!colNamesToOrders.contains(colName)) {
ret.set(false);
- if (!ignoreColumnExistence) {
- throw new ColumnNotFoundException(DEFAULT_SCHEMA_NAME, tableName, colName);
- }
+ throw new ColumnNotFoundException(DEFAULT_SCHEMA_NAME, tableName, colName);
} else {
colNames0.add(colName);
}
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/AlterTableAddCommand.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/AlterTableAddCommand.java
index ee28913d95..0ed180e899 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/AlterTableAddCommand.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/AlterTableAddCommand.java
@@ -24,9 +24,6 @@ import java.util.List;
*/
@SuppressWarnings("AssignmentOrReturnOfFieldWithMutableType")
public class AlterTableAddCommand extends AbstractTableDdlCommand {
- /** Quietly ignore this command if column already exists. */
- private boolean ifColumnNotExists;
-
/** Columns. */
private List<ColumnDefinition> cols;
@@ -37,12 +34,4 @@ public class AlterTableAddCommand extends AbstractTableDdlCommand {
public void columns(List<ColumnDefinition> cols) {
this.cols = cols;
}
-
- public boolean ifColumnNotExists() {
- return ifColumnNotExists;
- }
-
- public void ifColumnNotExists(boolean ifColumnNotExists) {
- this.ifColumnNotExists = ifColumnNotExists;
- }
}
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/AlterTableDropCommand.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/AlterTableDropCommand.java
index 6c78ff6581..d136a93b3d 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/AlterTableDropCommand.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/AlterTableDropCommand.java
@@ -25,9 +25,6 @@ import java.util.Set;
*/
@SuppressWarnings("AssignmentOrReturnOfFieldWithMutableType")
public class AlterTableDropCommand extends AbstractTableDdlCommand {
- /** Quietly ignore this command if column is not exists. */
- private boolean ifColumnExists;
-
/** Columns. */
private Set<String> cols;
@@ -43,22 +40,4 @@ public class AlterTableDropCommand extends AbstractTableDdlCommand {
public void columns(Set<String> cols) {
this.cols = cols;
}
-
- /**
- * Exists flag.
- *
- * @return Quietly ignore this command if column is not exists.
- */
- public boolean ifColumnExists() {
- return ifColumnExists;
- }
-
- /**
- * Set exists flag.
- *
- * @param ifColumnExists Quietly ignore this command if column is not exists.
- */
- public void ifColumnExists(boolean ifColumnExists) {
- this.ifColumnExists = ifColumnExists;
- }
}
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverter.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverter.java
index 9bc1b486fb..77d50e3ec6 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverter.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/ddl/DdlSqlToCommandConverter.java
@@ -385,7 +385,6 @@ public class DdlSqlToCommandConverter {
alterTblCmd.schemaName(deriveSchemaName(alterTblNode.name(), ctx));
alterTblCmd.tableName(deriveObjectName(alterTblNode.name(), ctx, "table name"));
alterTblCmd.ifTableExists(alterTblNode.ifExists());
- alterTblCmd.ifColumnNotExists(alterTblNode.ifNotExistsColumn());
List<ColumnDefinition> cols = new ArrayList<>(alterTblNode.columns().size());
@@ -468,7 +467,6 @@ public class DdlSqlToCommandConverter {
alterTblCmd.schemaName(deriveSchemaName(alterTblNode.name(), ctx));
alterTblCmd.tableName(deriveObjectName(alterTblNode.name(), ctx, "table name"));
alterTblCmd.ifTableExists(alterTblNode.ifExists());
- alterTblCmd.ifColumnExists(alterTblNode.ifExistsColumn());
Set<String> cols = new HashSet<>(alterTblNode.columns().size());
alterTblNode.columns().forEach(c -> cols.add(((SqlIdentifier) c).getSimple()));
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlAlterTableAddColumn.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlAlterTableAddColumn.java
index 563acb31e7..641ae536f3 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlAlterTableAddColumn.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlAlterTableAddColumn.java
@@ -30,17 +30,13 @@ import org.apache.calcite.util.ImmutableNullableList;
* Parse tree for {@code ALTER TABLE ... ADD COLUMN} statement.
*/
public class IgniteSqlAlterTableAddColumn extends IgniteAbstractSqlAlterTable {
- /** Whether to ignore error in case column with the same name already exists. */
- private final boolean ifNotExistsColumn;
-
/** Introduced columns. */
private final SqlNodeList columns;
/** Constructor. */
public IgniteSqlAlterTableAddColumn(SqlParserPos pos, boolean ifExists, SqlIdentifier tblName,
- boolean ifNotExistsColumn, SqlNodeList columns) {
+ SqlNodeList columns) {
super(pos, ifExists, tblName);
- this.ifNotExistsColumn = ifNotExistsColumn;
this.columns = Objects.requireNonNull(columns, "columns list");
}
@@ -54,18 +50,9 @@ public class IgniteSqlAlterTableAddColumn extends IgniteAbstractSqlAlterTable {
writer.keyword("ADD");
writer.keyword("COLUMN");
- if (ifNotExistsColumn) {
- writer.keyword("IF NOT EXISTS");
- }
-
columns.unparse(writer, leftPrec, rightPrec);
}
- /** Returns whether the IF NOT EXISTS is specified for columns. */
- public boolean ifNotExistsColumn() {
- return ifNotExistsColumn;
- }
-
/** Processing columns definition. */
public SqlNodeList columns() {
return columns;
diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlAlterTableDropColumn.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlAlterTableDropColumn.java
index afd4ec9142..b5b26640ec 100644
--- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlAlterTableDropColumn.java
+++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/IgniteSqlAlterTableDropColumn.java
@@ -30,17 +30,13 @@ import org.apache.calcite.util.ImmutableNullableList;
* Parse tree for {@code ALTER TABLE ... DROP COLUMN} statement.
*/
public class IgniteSqlAlterTableDropColumn extends IgniteAbstractSqlAlterTable {
- /** Whether to ignore error in case column with specified name doesn't exist. */
- private final boolean ifExistsColumn;
-
- /** Coluns to drop. */
+ /** Columns to drop. */
private final SqlNodeList columns;
/** Constructor. */
public IgniteSqlAlterTableDropColumn(SqlParserPos pos, boolean ifExists, SqlIdentifier tblName,
- boolean ifExistsColumn, SqlNodeList columns) {
+ SqlNodeList columns) {
super(pos, ifExists, tblName);
- this.ifExistsColumn = ifExistsColumn;
this.columns = Objects.requireNonNull(columns, "columns list");
}
@@ -56,22 +52,9 @@ public class IgniteSqlAlterTableDropColumn extends IgniteAbstractSqlAlterTable {
writer.keyword("DROP");
writer.keyword("COLUMN");
- if (ifExistsColumn) {
- writer.keyword("IF EXISTS");
- }
-
columns.unparse(writer, leftPrec, rightPrec);
}
- /**
- * Existance flag.
- *
- * @return Whether the IF EXISTS is specified for columns.
- */
- public boolean ifExistsColumn() {
- return ifExistsColumn;
- }
-
/** Processing columns definition. */
public SqlNodeList columns() {
return columns;