Skip to content

Commit 32e1642

Browse files
CaideyipiJackieTien97
authored andcommitted
Fixed the bug of 305 error for unsupported table opreations #16816
(cherry picked from commit fb899b1)
1 parent d961572 commit 32e1642

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

integration-test/src/test/java/org/apache/iotdb/relational/it/schema/IoTDBTableIT.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,22 @@ public void testManageTable() {
150150
assertEquals(tableNames.length, cnt);
151151
}
152152

153+
// Test unsupported, to be deleted
154+
try {
155+
statement.execute("alter table test1.table1 rename to tableN");
156+
} catch (final SQLException e) {
157+
assertEquals("701: The renaming for base table is currently unsupported", e.getMessage());
158+
}
159+
160+
// Test unsupported, to be deleted
161+
try {
162+
statement.execute(
163+
"alter table if exists test_db.table1 rename column if exists model to modelType");
164+
} catch (final SQLException e) {
165+
assertEquals(
166+
"701: The renaming for base table column is currently unsupported", e.getMessage());
167+
}
168+
153169
// Alter table properties
154170
statement.execute("alter table test1.table1 set properties ttl=1000000");
155171
ttls = new String[] {"1000000"};

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/RenameColumn.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package org.apache.iotdb.db.queryengine.plan.relational.sql.ast;
2121

22+
import org.apache.iotdb.db.exception.sql.SemanticException;
23+
2224
import com.google.common.collect.ImmutableList;
2325

2426
import java.util.List;
@@ -52,8 +54,7 @@ public RenameColumn(
5254
this.columnIfNotExists = columnIfNotExists;
5355
this.view = view;
5456
if (!view) {
55-
throw new UnsupportedOperationException(
56-
"The renaming for base table column is currently unsupported");
57+
throw new SemanticException("The renaming for base table column is currently unsupported");
5758
}
5859
}
5960

iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/sql/ast/RenameTable.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
package org.apache.iotdb.db.queryengine.plan.relational.sql.ast;
2121

22+
import org.apache.iotdb.db.exception.sql.SemanticException;
23+
2224
import com.google.common.collect.ImmutableList;
2325

2426
import java.util.List;
@@ -46,8 +48,7 @@ public RenameTable(
4648
this.tableIfExists = tableIfExists;
4749
this.view = view;
4850
if (!view) {
49-
throw new UnsupportedOperationException(
50-
"The renaming for base table is currently unsupported");
51+
throw new SemanticException("The renaming for base table is currently unsupported");
5152
}
5253
}
5354

0 commit comments

Comments
 (0)