[fix](type) forbid time type when creating table (#15093)

This commit is contained in:
Mingyu Chen
2022-12-16 21:54:35 +08:00
committed by GitHub
parent 67b9d469c1
commit 4530b531e7
2 changed files with 7 additions and 2 deletions

View File

@ -401,6 +401,10 @@ public class CreateTableStmt extends DdlStmt {
}
}
if (columnDef.getType().isTime() || columnDef.getType().isTimeV2()) {
throw new AnalysisException("Time type is not supported for olap table");
}
if (columnDef.getType().isObjectStored()) {
hasObjectStored = true;
objectStoredColumn = columnDef.getName();

View File

@ -118,7 +118,8 @@ public class AlterTest {
+ "PROPERTIES('replication_num' = '1');");
createTable(
"CREATE TABLE test.tbl6\n" + "(\n" + " k1 datetime(3),\n" + " k2 time(3),\n" + " v1 int \n,"
"CREATE TABLE test.tbl6\n" + "(\n" + " k1 datetime(3),\n" + " k2 datetime(3),\n"
+ " v1 int \n,"
+ " v2 datetime(3)\n" + ") ENGINE=OLAP\n" + "UNIQUE KEY (k1,k2)\n"
+ "PARTITION BY RANGE(k1)\n" + "(\n"
+ " PARTITION p1 values less than('2020-02-01 00:00:00'),\n"
@ -410,7 +411,7 @@ public class AlterTest {
alterTable(stmt, true);
// no conflict
stmt = "alter table test.tbl6 add column k3 int, add column k4 time(6)";
stmt = "alter table test.tbl6 add column k3 int, add column k4 datetime(6)";
alterTable(stmt, false);
waitSchemaChangeJobDone(false);