[fix](compile) fe compile failed when generate doc and FE UT failed (#26164)
1. FE could not compile because below error. Intro by PR #25933 ``` [INFO] --- exec:3.1.0:java (doc) @ fe-core --- ... Failed to generate doc for ignoreRuntimeFilterIds ``` 2. fix UT bugs intro by below PRs > - #25951 > - #26031 3. because fe could not compile, FE UT CI do not work well. So, some UT failed be introduced by the PRs merged after PR #25933 merged. So this PR revert them to fix FE UT > - Revert "[Bug](materialized-view) SelectMaterializedIndexWithAggregate do not change plan > when match ba… (#26145)" > This reverts commit 8d7abf60f94d2d1208b71e96b9290ea02122b8d8. > - Revert "[enhancement](Nereids): optimize GroupExpressionMatching (#26130)" > This reverts commit 19122b55cd95af097b4ef7b6eb809f37db29765f. > - Revert "[Performance](Nereids): optimize GroupExpressionMatching (#26084)" > This reverts commit 0d956e90cf920039b8baa79c170a298be56a128d.
This commit is contained in:
@ -48,21 +48,21 @@ public class AddColumnsClauseTest {
|
||||
columns.add(definition);
|
||||
AddColumnsClause clause = new AddColumnsClause(columns, null, null);
|
||||
clause.analyze(analyzer);
|
||||
Assert.assertEquals("ADD COLUMN (`col1` int(11) NOT NULL DEFAULT \"0\" COMMENT \"\", "
|
||||
+ "`col2` int(11) NOT NULL DEFAULT \"0\" COMMENT \"\")", clause.toString());
|
||||
Assert.assertEquals("ADD COLUMN (`col1` INT NOT NULL DEFAULT \"0\" COMMENT \"\", "
|
||||
+ "`col2` INT NOT NULL DEFAULT \"0\" COMMENT \"\")", clause.toString());
|
||||
|
||||
clause = new AddColumnsClause(columns, "", null);
|
||||
clause.analyze(analyzer);
|
||||
Assert.assertEquals("ADD COLUMN (`col1` int(11) NOT NULL DEFAULT \"0\" COMMENT \"\", "
|
||||
+ "`col2` int(11) NOT NULL DEFAULT \"0\" COMMENT \"\")",
|
||||
Assert.assertEquals("ADD COLUMN (`col1` INT NOT NULL DEFAULT \"0\" COMMENT \"\", "
|
||||
+ "`col2` INT NOT NULL DEFAULT \"0\" COMMENT \"\")",
|
||||
clause.toString());
|
||||
Assert.assertNull(clause.getRollupName());
|
||||
|
||||
clause = new AddColumnsClause(columns, "testTable", null);
|
||||
clause.analyze(analyzer);
|
||||
|
||||
Assert.assertEquals("ADD COLUMN (`col1` int(11) NOT NULL DEFAULT \"0\" COMMENT \"\", "
|
||||
+ "`col2` int(11) NOT NULL DEFAULT \"0\" COMMENT \"\") IN `testTable`",
|
||||
Assert.assertEquals("ADD COLUMN (`col1` INT NOT NULL DEFAULT \"0\" COMMENT \"\", "
|
||||
+ "`col2` INT NOT NULL DEFAULT \"0\" COMMENT \"\") IN `testTable`",
|
||||
clause.toString());
|
||||
Assert.assertNull(clause.getProperties());
|
||||
Assert.assertEquals("testTable", clause.getRollupName());
|
||||
|
||||
@ -61,7 +61,7 @@ public class ColumnDefTest {
|
||||
ColumnDef column = new ColumnDef("col", intCol);
|
||||
column.analyze(true);
|
||||
|
||||
Assert.assertEquals("`col` int(11) NOT NULL COMMENT \"\"", column.toString());
|
||||
Assert.assertEquals("`col` INT NOT NULL COMMENT \"\"", column.toString());
|
||||
Assert.assertEquals("col", column.getName());
|
||||
Assert.assertEquals(PrimitiveType.INT, column.getType().getPrimitiveType());
|
||||
Assert.assertNull(column.getAggregateType());
|
||||
@ -72,14 +72,14 @@ public class ColumnDefTest {
|
||||
column.analyze(true);
|
||||
Assert.assertNull(column.getAggregateType());
|
||||
Assert.assertEquals("10", column.getDefaultValue());
|
||||
Assert.assertEquals("`col` int(11) NOT NULL DEFAULT \"10\" COMMENT \"\"", column.toSql());
|
||||
Assert.assertEquals("`col` INT NOT NULL DEFAULT \"10\" COMMENT \"\"", column.toSql());
|
||||
|
||||
// agg
|
||||
column = new ColumnDef("col", floatCol, false, AggregateType.SUM, false, new DefaultValue(true, "10"), "");
|
||||
column.analyze(true);
|
||||
Assert.assertEquals("10", column.getDefaultValue());
|
||||
Assert.assertEquals(AggregateType.SUM, column.getAggregateType());
|
||||
Assert.assertEquals("`col` float SUM NOT NULL DEFAULT \"10\" COMMENT \"\"", column.toSql());
|
||||
Assert.assertEquals("`col` FLOAT SUM NOT NULL DEFAULT \"10\" COMMENT \"\"", column.toSql());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -89,14 +89,14 @@ public class ColumnDefTest {
|
||||
ColumnDef column = new ColumnDef("col", intCol, false, AggregateType.REPLACE_IF_NOT_NULL, false, DefaultValue.NOT_SET, "");
|
||||
column.analyze(true);
|
||||
Assert.assertEquals(AggregateType.REPLACE_IF_NOT_NULL, column.getAggregateType());
|
||||
Assert.assertEquals("`col` int(11) REPLACE_IF_NOT_NULL NULL DEFAULT \"null\" COMMENT \"\"", column.toSql());
|
||||
Assert.assertEquals("`col` INT REPLACE_IF_NOT_NULL NULL DEFAULT \"null\" COMMENT \"\"", column.toSql());
|
||||
} // CHECKSTYLE IGNORE THIS LINE
|
||||
{ // CHECKSTYLE IGNORE THIS LINE
|
||||
// not allow null
|
||||
ColumnDef column = new ColumnDef("col", intCol, false, AggregateType.REPLACE_IF_NOT_NULL, false, new DefaultValue(true, "10"), "");
|
||||
column.analyze(true);
|
||||
Assert.assertEquals(AggregateType.REPLACE_IF_NOT_NULL, column.getAggregateType());
|
||||
Assert.assertEquals("`col` int(11) REPLACE_IF_NOT_NULL NULL DEFAULT \"10\" COMMENT \"\"", column.toSql());
|
||||
Assert.assertEquals("`col` INT REPLACE_IF_NOT_NULL NULL DEFAULT \"10\" COMMENT \"\"", column.toSql());
|
||||
} // CHECKSTYLE IGNORE THIS LINE
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
+ "as select * from `test`.`decimal_table`";
|
||||
createTableAsSelect(selectFromDecimal);
|
||||
Assertions.assertEquals("CREATE TABLE `select_decimal_table` (\n"
|
||||
+ " `userId` varchar(255) NOT NULL,\n"
|
||||
+ " `userId` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `amount_decimal` "
|
||||
+ "DECIMAL" + "(10, 2) NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
@ -160,8 +160,8 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableAsSelect(selectFromVarchar);
|
||||
ShowResultSet showResultSet = showCreateTableByName("select_varchar");
|
||||
Assertions.assertEquals("CREATE TABLE `select_varchar` (\n"
|
||||
+ " `userId` varchar(255) NOT NULL,\n"
|
||||
+ " `username` varchar(255) NOT NULL\n"
|
||||
+ " `userId` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `username` VARCHAR(255) NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`userId`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -186,7 +186,7 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
ShowResultSet showResultSet1 = showCreateTableByName("select_function_1");
|
||||
Assertions.assertEquals(
|
||||
"CREATE TABLE `select_function_1` (\n"
|
||||
+ " `__count_0` bigint(20) NULL\n"
|
||||
+ " `__count_0` BIGINT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`__count_0`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -209,11 +209,11 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
ShowResultSet showResultSet2 = showCreateTableByName("select_function_2");
|
||||
Assertions.assertEquals(
|
||||
"CREATE TABLE `select_function_2` (\n"
|
||||
+ " `__sum_0` bigint(20) NULL,\n"
|
||||
+ " `__sum_1` bigint(20) NULL,\n"
|
||||
+ " `__sum_2` bigint(20) NULL,\n"
|
||||
+ " `__count_3` bigint(20) NULL,\n"
|
||||
+ " `__count_4` bigint(20) NULL\n"
|
||||
+ " `__sum_0` BIGINT NULL,\n"
|
||||
+ " `__sum_1` BIGINT NULL,\n"
|
||||
+ " `__sum_2` BIGINT NULL,\n"
|
||||
+ " `__count_3` BIGINT NULL,\n"
|
||||
+ " `__count_4` BIGINT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`__sum_0`, `__sum_1`, `__sum_2`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -237,7 +237,7 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableAsSelect(selectAlias1);
|
||||
ShowResultSet showResultSet1 = showCreateTableByName("select_alias_1");
|
||||
Assertions.assertEquals("CREATE TABLE `select_alias_1` (\n"
|
||||
+ " `amount` bigint(20) NULL\n"
|
||||
+ " `amount` BIGINT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`amount`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -256,8 +256,8 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableAsSelect(selectAlias2);
|
||||
ShowResultSet showResultSet2 = showCreateTableByName("select_alias_2");
|
||||
Assertions.assertEquals("CREATE TABLE `select_alias_2` (\n"
|
||||
+ " `alias_name` varchar(255) NOT NULL,\n"
|
||||
+ " `username` varchar(255) NOT NULL\n"
|
||||
+ " `alias_name` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `username` VARCHAR(255) NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`alias_name`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -282,9 +282,9 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableAsSelect(selectFromJoin);
|
||||
ShowResultSet showResultSet = showCreateTableByName("select_join");
|
||||
Assertions.assertEquals("CREATE TABLE `select_join` (\n"
|
||||
+ " `userId` varchar(255) NOT NULL,\n"
|
||||
+ " `username` varchar(255) NOT NULL,\n"
|
||||
+ " `status` int(11) NOT NULL\n"
|
||||
+ " `userId` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `username` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `status` INT NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`userId`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -305,10 +305,10 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableAsSelect(selectFromJoin1);
|
||||
ShowResultSet showResultSet1 = showCreateTableByName("select_join1");
|
||||
Assertions.assertEquals("CREATE TABLE `select_join1` (\n"
|
||||
+ " `userId1` varchar(255) NOT NULL,\n"
|
||||
+ " `userId2` varchar(255) NOT NULL,\n"
|
||||
+ " `username` varchar(255) NOT NULL,\n"
|
||||
+ " `status` int(11) NOT NULL\n"
|
||||
+ " `userId1` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `userId2` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `username` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `status` INT NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`userId1`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -334,9 +334,9 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableAsSelect(selectFromName);
|
||||
ShowResultSet showResultSet = showCreateTableByName("select_name");
|
||||
Assertions.assertEquals("CREATE TABLE `select_name` (\n"
|
||||
+ " `user` varchar(255) NOT NULL,\n"
|
||||
+ " `testname` varchar(255) NOT NULL,\n"
|
||||
+ " `userstatus` int(11) NOT NULL\n"
|
||||
+ " `user` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `testname` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `userstatus` INT NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`user`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -361,7 +361,7 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
ShowResultSet showResultSet = showCreateTableByName("select_union");
|
||||
Assertions.assertEquals(
|
||||
"CREATE TABLE `select_union` (\n"
|
||||
+ " `userId` varchar(255) NULL\n"
|
||||
+ " `userId` VARCHAR(255) NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`userId`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -385,7 +385,7 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
ShowResultSet showResultSet = showCreateTableByName("select_cte");
|
||||
Assertions.assertEquals(
|
||||
"CREATE TABLE `select_cte` (\n"
|
||||
+ " `userId` varchar(255) NOT NULL\n"
|
||||
+ " `userId` VARCHAR(255) NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`userId`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -405,7 +405,7 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableAsSelect(selectFromCteAndUnion);
|
||||
ShowResultSet showResultSet1 = showCreateTableByName("select_cte_union");
|
||||
Assertions.assertEquals("CREATE TABLE `select_cte_union` (\n"
|
||||
+ " `id` tinyint(4) NULL\n"
|
||||
+ " `id` TINYINT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`id`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -429,8 +429,8 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableAsSelect(selectFromPartition);
|
||||
ShowResultSet showResultSet = showCreateTableByName("selectPartition");
|
||||
Assertions.assertEquals("CREATE TABLE `selectPartition` (\n"
|
||||
+ " `userId` varchar(255) NOT NULL,\n"
|
||||
+ " `username` varchar(255) NOT NULL\n"
|
||||
+ " `userId` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `username` VARCHAR(255) NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`userId`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -456,8 +456,8 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableAsSelect(createSql);
|
||||
ShowResultSet showResultSet = showCreateTableByName("test_default_timestamp");
|
||||
Assertions.assertEquals("CREATE TABLE `test_default_timestamp` (\n"
|
||||
+ " `userId` varchar(255) NOT NULL,\n"
|
||||
+ " `date` datetime"
|
||||
+ " `userId` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `date` DATETIME"
|
||||
+ " NULL DEFAULT CURRENT_TIMESTAMP\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`userId`)\n"
|
||||
@ -483,7 +483,7 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
ShowResultSet showResultSet = showCreateTableByName("test_agg_value");
|
||||
Assertions.assertEquals(
|
||||
"CREATE TABLE `test_agg_value` (\n"
|
||||
+ " `username` varchar(255) NOT NULL\n"
|
||||
+ " `username` VARCHAR(255) NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`username`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -508,8 +508,8 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
ShowResultSet showResultSet = showCreateTableByName("test_use_key_type");
|
||||
Assertions.assertEquals(
|
||||
"CREATE TABLE `test_use_key_type` (\n"
|
||||
+ " `userId` varchar(255) NOT NULL,\n"
|
||||
+ " `username` varchar(255) NOT NULL\n"
|
||||
+ " `userId` VARCHAR(255) NOT NULL,\n"
|
||||
+ " `username` VARCHAR(255) NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "UNIQUE KEY(`userId`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -558,8 +558,8 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createStmts.add(createTableStmts.get(0));
|
||||
if (tbl.getName().equals("qs1")) {
|
||||
Assert.assertEquals("CREATE TABLE `qs1` (\n"
|
||||
+ " `k1` int(11) NULL,\n"
|
||||
+ " `k2` int(11) NULL\n"
|
||||
+ " `k1` INT NULL,\n"
|
||||
+ " `k2` INT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`k1`, `k2`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -576,8 +576,8 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
createTableStmts.get(0));
|
||||
} else {
|
||||
Assert.assertEquals("CREATE TABLE `qs2` (\n"
|
||||
+ " `k1` int(11) NULL,\n"
|
||||
+ " `k2` int(11) NULL\n"
|
||||
+ " `k1` INT NULL,\n"
|
||||
+ " `k2` INT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`k1`, `k2`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
@ -607,9 +607,9 @@ public class CreateTableAsSelectStmtTest extends TestWithFeService {
|
||||
String showStr = showResultSet.getResultRows().get(0).get(1);
|
||||
Assertions.assertEquals(
|
||||
"CREATE TABLE `varchar_len1` (\n"
|
||||
+ " `__literal_0` varchar(*) NULL,\n"
|
||||
+ " `__concat_1` varchar(*) NULL,\n"
|
||||
+ " `userId` varchar(255) NOT NULL\n"
|
||||
+ " `__literal_0` VARCHAR(*) NULL,\n"
|
||||
+ " `__concat_1` VARCHAR(*) NULL,\n"
|
||||
+ " `userId` VARCHAR(255) NOT NULL\n"
|
||||
+ ") ENGINE=OLAP\n"
|
||||
+ "DUPLICATE KEY(`__literal_0`)\n"
|
||||
+ "COMMENT 'OLAP'\n"
|
||||
|
||||
@ -337,7 +337,7 @@ public class CreateTableStmtTest {
|
||||
null, null, "");
|
||||
expectedEx.expect(AnalysisException.class);
|
||||
expectedEx.expectMessage(
|
||||
"Aggregate type `col3` hll NONE NOT NULL COMMENT \"\" is not compatible with primitive type hll");
|
||||
"Aggregate type `col3` HLL NONE NOT NULL COMMENT \"\" is not compatible with primitive type HLL");
|
||||
stmt.analyze(analyzer);
|
||||
}
|
||||
|
||||
@ -419,8 +419,8 @@ public class CreateTableStmtTest {
|
||||
stmt.analyze(analyzer);
|
||||
|
||||
Assert.assertEquals(
|
||||
"CREATE EXTERNAL TABLE `testCluster:db1`.`table1` (\n" + " `id` int(11) NOT NULL COMMENT \"\",\n"
|
||||
+ " `name` int(11) NULL COMMENT \"\"\n" + ") ENGINE = hudi\n"
|
||||
"CREATE EXTERNAL TABLE `testCluster:db1`.`table1` (\n" + " `id` INT NOT NULL COMMENT \"\",\n"
|
||||
+ " `name` INT NULL COMMENT \"\"\n" + ") ENGINE = hudi\n"
|
||||
+ "PROPERTIES (\"hudi.database\" = \"doris\",\n"
|
||||
+ "\"hudi.hive.metastore.uris\" = \"thrift://127.0.0.1:9087\",\n"
|
||||
+ "\"hudi.table\" = \"test\")", stmt.toString());
|
||||
@ -455,8 +455,8 @@ public class CreateTableStmtTest {
|
||||
properties, null, "", null);
|
||||
|
||||
String createTableSql = "CREATE TABLE IF NOT EXISTS `demo`.`testTosql1` (\n"
|
||||
+ " `a` bigint(20) NOT NULL COMMENT \"\",\n"
|
||||
+ " `b` int(11) NOT NULL COMMENT \"\"\n"
|
||||
+ " `a` BIGINT NOT NULL COMMENT \"\",\n"
|
||||
+ " `b` INT NOT NULL COMMENT \"\"\n"
|
||||
+ ") ENGINE = olap\n"
|
||||
+ "AGGREGATE KEY(`a`)\n"
|
||||
+ "PROPERTIES (\"replication_num\" = \"1\")";
|
||||
@ -484,14 +484,14 @@ public class CreateTableStmtTest {
|
||||
tableName, columnDefs, engineName, keysDesc, null, null,
|
||||
properties, null, "", null);
|
||||
createTableSql = "CREATE TABLE `demo`.`testTosql2` (\n"
|
||||
+ " `a` bigint(20) NOT NULL COMMENT \"\",\n"
|
||||
+ " `b` int(11) NOT NULL COMMENT \"\",\n"
|
||||
+ " `c` text NULL COMMENT \"\",\n"
|
||||
+ " `d` double NULL COMMENT \"\",\n"
|
||||
+ " `e` decimalv3(38, 0) NOT NULL COMMENT \"\",\n"
|
||||
+ " `f` date NOT NULL COMMENT \"\",\n"
|
||||
+ " `g` smallint(6) NOT NULL COMMENT \"\",\n"
|
||||
+ " `h` boolean NOT NULL COMMENT \"\"\n"
|
||||
+ " `a` BIGINT NOT NULL COMMENT \"\",\n"
|
||||
+ " `b` INT NOT NULL COMMENT \"\",\n"
|
||||
+ " `c` TEXT NULL COMMENT \"\",\n"
|
||||
+ " `d` DOUBLE NULL COMMENT \"\",\n"
|
||||
+ " `e` DECIMALV3(38, 0) NOT NULL COMMENT \"\",\n"
|
||||
+ " `f` DATE NOT NULL COMMENT \"\",\n"
|
||||
+ " `g` SMALLINT NOT NULL COMMENT \"\",\n"
|
||||
+ " `h` BOOLEAN NOT NULL COMMENT \"\"\n"
|
||||
+ ") ENGINE = olap\n"
|
||||
+ "DUPLICATE KEY(`a`, `d`, `f`)\n"
|
||||
+ "PROPERTIES (\"replication_num\" = \"10\")";
|
||||
|
||||
@ -48,7 +48,7 @@ public class ShowCreateTableStmtTest extends TestWithFeService {
|
||||
String sql = "show create table table1";
|
||||
ShowResultSet showResultSet = showCreateTable(sql);
|
||||
String showSql = showResultSet.getResultRows().get(0).get(1);
|
||||
Assertions.assertTrue(showSql.contains("`k1` int(11) NULL COMMENT 'test column k1'"));
|
||||
Assertions.assertTrue(showSql.contains("`k1` INT NULL COMMENT 'test column k1'"));
|
||||
Assertions.assertTrue(showSql.contains("COMMENT 'test table1'"));
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ public class ColumnTypeTest {
|
||||
type.analyze(null);
|
||||
|
||||
Assert.assertEquals(PrimitiveType.INT, type.getType().getPrimitiveType());
|
||||
Assert.assertEquals("int(11)", type.toSql());
|
||||
Assert.assertEquals("INT", type.toSql());
|
||||
|
||||
// equal type
|
||||
TypeDef type2 = TypeDef.create(PrimitiveType.INT);
|
||||
@ -69,9 +69,9 @@ public class ColumnTypeTest {
|
||||
public void testCharType() throws AnalysisException {
|
||||
TypeDef type = TypeDef.createVarchar(10);
|
||||
type.analyze(null);
|
||||
Assert.assertEquals("varchar(10)", type.toString());
|
||||
Assert.assertEquals("VARCHAR(10)", type.toString());
|
||||
Assert.assertEquals(PrimitiveType.VARCHAR, type.getType().getPrimitiveType());
|
||||
Assert.assertEquals(10, ((ScalarType) type.getType()).getLength());
|
||||
Assert.assertEquals(10, type.getType().getLength());
|
||||
|
||||
// equal type
|
||||
TypeDef type2 = TypeDef.createVarchar(10);
|
||||
@ -91,10 +91,10 @@ public class ColumnTypeTest {
|
||||
TypeDef type = TypeDef.createDecimal(12, 5);
|
||||
type.analyze(null);
|
||||
if (Config.enable_decimal_conversion) {
|
||||
Assert.assertEquals("decimalv3(12, 5)", type.toString());
|
||||
Assert.assertEquals("DECIMALV3(12, 5)", type.toString());
|
||||
Assert.assertEquals(PrimitiveType.DECIMAL64, type.getType().getPrimitiveType());
|
||||
} else {
|
||||
Assert.assertEquals("decimal(12, 5)", type.toString());
|
||||
Assert.assertEquals("DECIMAL(12, 5)", type.toString());
|
||||
Assert.assertEquals(PrimitiveType.DECIMALV2, type.getType().getPrimitiveType());
|
||||
}
|
||||
Assert.assertEquals(12, ((ScalarType) type.getType()).getScalarPrecision());
|
||||
@ -119,7 +119,7 @@ public class ColumnTypeTest {
|
||||
public void testDatetimeV2() throws AnalysisException {
|
||||
TypeDef type = TypeDef.createDatetimeV2(3);
|
||||
type.analyze(null);
|
||||
Assert.assertEquals("datetimev2(3)", type.toString());
|
||||
Assert.assertEquals("DATETIMEV2(3)", type.toString());
|
||||
Assert.assertEquals(PrimitiveType.DATETIMEV2, type.getType().getPrimitiveType());
|
||||
Assert.assertEquals(ScalarType.DATETIME_PRECISION, ((ScalarType) type.getType()).getScalarPrecision());
|
||||
Assert.assertEquals(3, ((ScalarType) type.getType()).getScalarScale());
|
||||
@ -160,7 +160,7 @@ public class ColumnTypeTest {
|
||||
public void testTimeV2() throws AnalysisException {
|
||||
TypeDef type = TypeDef.createTimeV2(3);
|
||||
type.analyze(null);
|
||||
Assert.assertEquals("time(3)", type.toString());
|
||||
Assert.assertEquals("TIME(3)", type.toString());
|
||||
Assert.assertEquals(PrimitiveType.TIMEV2, type.getType().getPrimitiveType());
|
||||
Assert.assertEquals(ScalarType.DATETIME_PRECISION, ((ScalarType) type.getType()).getScalarPrecision());
|
||||
Assert.assertEquals(3, ((ScalarType) type.getType()).getScalarScale());
|
||||
|
||||
@ -227,25 +227,25 @@ public class EsUtilTest extends EsTestCase {
|
||||
String name = column.getName();
|
||||
String type = column.getType().toSql();
|
||||
if ("test2".equals(name)) {
|
||||
Assertions.assertEquals("datetimev2(0)", type);
|
||||
Assertions.assertEquals("DATETIMEV2(0)", type);
|
||||
}
|
||||
if ("test3".equals(name)) {
|
||||
Assertions.assertEquals("datetimev2(0)", type);
|
||||
Assertions.assertEquals("DATETIMEV2(0)", type);
|
||||
}
|
||||
if ("test4".equals(name)) {
|
||||
Assertions.assertEquals("datev2", type);
|
||||
Assertions.assertEquals("DATEV2", type);
|
||||
}
|
||||
if ("test5".equals(name)) {
|
||||
Assertions.assertEquals("datetimev2(0)", type);
|
||||
Assertions.assertEquals("DATETIMEV2(0)", type);
|
||||
}
|
||||
if ("test6".equals(name)) {
|
||||
Assertions.assertEquals("datev2", type);
|
||||
Assertions.assertEquals("DATEV2", type);
|
||||
}
|
||||
if ("test7".equals(name)) {
|
||||
Assertions.assertEquals("datetimev2(0)", type);
|
||||
Assertions.assertEquals("DATETIMEV2(0)", type);
|
||||
}
|
||||
if ("test8".equals(name)) {
|
||||
Assertions.assertEquals("bigint(20)", type);
|
||||
Assertions.assertEquals("BIGINT", type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,8 +255,8 @@ public class EsUtilTest extends EsTestCase {
|
||||
ObjectNode testFieldAlias = EsUtil.getRootSchema(
|
||||
EsUtil.getMapping(loadJsonFromFile("data/es/test_field_alias.json")), null, new ArrayList<>());
|
||||
List<Column> parseColumns = EsUtil.genColumnsFromEs("test_field_alias", null, testFieldAlias, true, new ArrayList<>());
|
||||
Assertions.assertEquals("datetimev2(0)", parseColumns.get(2).getType().toSql());
|
||||
Assertions.assertEquals("text", parseColumns.get(4).getType().toSql());
|
||||
Assertions.assertEquals("DATETIMEV2(0)", parseColumns.get(2).getType().toSql());
|
||||
Assertions.assertEquals("TEXT", parseColumns.get(4).getType().toSql());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -34,6 +34,7 @@ public class TokenManagerTest {
|
||||
@Test
|
||||
public void testTokenCheck() throws UserException {
|
||||
TokenManager tokenManager = new TokenManager();
|
||||
tokenManager.start();
|
||||
String token = tokenManager.acquireToken();
|
||||
Assert.assertTrue(tokenManager.checkAuthToken(token));
|
||||
}
|
||||
@ -41,6 +42,7 @@ public class TokenManagerTest {
|
||||
@Test
|
||||
public void testSameToken() throws UserException {
|
||||
TokenManager tokenManager = new TokenManager();
|
||||
tokenManager.start();
|
||||
String token1 = tokenManager.acquireToken();
|
||||
String token2 = tokenManager.acquireToken();
|
||||
Assert.assertNotNull(token1);
|
||||
|
||||
@ -573,11 +573,11 @@ public class QueryPlanTest extends TestWithFeService {
|
||||
// disable implicit cast hll/bitmap to string
|
||||
assertSQLPlanOrErrorMsgContains(
|
||||
"select length(id2) from test.hll_table;",
|
||||
"No matching function with signature: length(hll)"
|
||||
"No matching function with signature: length(HLL)"
|
||||
);
|
||||
assertSQLPlanOrErrorMsgContains(
|
||||
"select length(id2) from test.bitmap_table;",
|
||||
"No matching function with signature: length(bitmap)"
|
||||
"No matching function with signature: length(BITMAP)"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ public class TableFunctionPlanTest {
|
||||
explainString.contains("table function: explode_split(`default_cluster:db1`.`tbl1`.`k2`, ',')"));
|
||||
Assert.assertTrue(explainString.contains("tuple ids: 0 1"));
|
||||
Assert.assertTrue(explainString.contains("TupleDescriptor{id=1, tbl=tmp, byteSize=32}"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=varchar"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=VARCHAR"));
|
||||
}
|
||||
|
||||
/* Case2 without output explode column
|
||||
@ -95,7 +95,7 @@ public class TableFunctionPlanTest {
|
||||
explainString.contains("table function: explode_split(`default_cluster:db1`.`tbl1`.`k2`, ',')"));
|
||||
Assert.assertTrue(explainString.contains("tuple ids: 0 1"));
|
||||
Assert.assertTrue(explainString.contains("TupleDescriptor{id=1, tbl=tmp, byteSize=32}"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=varchar"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=VARCHAR"));
|
||||
}
|
||||
|
||||
/* Case3 group by explode column
|
||||
@ -116,7 +116,7 @@ public class TableFunctionPlanTest {
|
||||
explainString.contains("table function: explode_split(`default_cluster:db1`.`tbl1`.`k2`, ',')"));
|
||||
Assert.assertTrue(explainString.contains("tuple ids: 0 1"));
|
||||
Assert.assertTrue(explainString.contains("TupleDescriptor{id=1, tbl=tmp, byteSize=32}"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=varchar"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=VARCHAR"));
|
||||
// group by tuple
|
||||
Assert.assertTrue(explainString.contains("TupleDescriptor{id=2, tbl=null, byteSize=32}"));
|
||||
}
|
||||
@ -135,7 +135,7 @@ public class TableFunctionPlanTest {
|
||||
Assert.assertTrue(explainString.contains("PREDICATES: `e1` = '1'"));
|
||||
Assert.assertTrue(explainString.contains("tuple ids: 0 1"));
|
||||
Assert.assertTrue(explainString.contains("TupleDescriptor{id=1, tbl=tmp, byteSize=32}"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=varchar"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=VARCHAR"));
|
||||
}
|
||||
|
||||
/* Case5 where normal column
|
||||
@ -151,7 +151,7 @@ public class TableFunctionPlanTest {
|
||||
explainString.contains("table function: explode_split(`default_cluster:db1`.`tbl1`.`k2`, ',')"));
|
||||
Assert.assertTrue(explainString.contains("tuple ids: 0 1"));
|
||||
Assert.assertTrue(explainString.contains("TupleDescriptor{id=1, tbl=tmp, byteSize=32}"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=varchar"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e1, colUniqueId=-1, type=VARCHAR"));
|
||||
Assert.assertTrue(UtFrameUtils.checkPlanResultContainsNode(explainString, 0, "OlapScanNode"));
|
||||
Assert.assertTrue(explainString.contains("PREDICATES: `k1` = 1"));
|
||||
}
|
||||
@ -171,10 +171,10 @@ public class TableFunctionPlanTest {
|
||||
Assert.assertTrue(explainString.contains("lateral view tuple id: 1 2"));
|
||||
// lateral view 2 tuple
|
||||
Assert.assertTrue(explainString.contains("TupleDescriptor{id=1, tbl=tmp2, byteSize=32}"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e2, colUniqueId=-1, type=varchar"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=e2, colUniqueId=-1, type=VARCHAR"));
|
||||
// lateral view 1 tuple
|
||||
Assert.assertTrue(explainString.contains("TupleDescriptor{id=2, tbl=tmp1, byteSize=32}"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=2, col=e1, colUniqueId=-1, type=varchar"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=2, col=e1, colUniqueId=-1, type=VARCHAR"));
|
||||
}
|
||||
|
||||
// test explode_split function
|
||||
@ -188,11 +188,11 @@ public class TableFunctionPlanTest {
|
||||
public void errorParam() throws Exception {
|
||||
String sql = "explain select /*+ SET_VAR(enable_nereids_planner=false) */ k1, e1 from db1.tbl1 lateral view explode_split(k2) tmp as e1;";
|
||||
String explainString = UtFrameUtils.getSQLPlanOrErrorMsg(ctx, sql);
|
||||
Assert.assertTrue(explainString.contains("No matching function with signature: explode_split(varchar(1))"));
|
||||
Assert.assertTrue(explainString.contains("No matching function with signature: explode_split(VARCHAR(1))"));
|
||||
|
||||
sql = "explain select /*+ SET_VAR(enable_nereids_planner=false) */ k1, e1 from db1.tbl1 lateral view explode_split(k1) tmp as e1;";
|
||||
explainString = UtFrameUtils.getSQLPlanOrErrorMsg(ctx, sql);
|
||||
Assert.assertTrue(explainString.contains("No matching function with signature: explode_split(int(11))"));
|
||||
Assert.assertTrue(explainString.contains("No matching function with signature: explode_split(INT)"));
|
||||
}
|
||||
|
||||
/* Case2 table function in where stmt
|
||||
@ -203,7 +203,7 @@ public class TableFunctionPlanTest {
|
||||
String sql = "explain select /*+ SET_VAR(enable_nereids_planner=false) */ k1 from db1.tbl1 where explode_split(k2, \",\");";
|
||||
String explainString = UtFrameUtils.getSQLPlanOrErrorMsg(ctx, sql);
|
||||
Assert.assertTrue(explainString,
|
||||
explainString.contains("No matching function with signature: explode_split(varchar(1), varchar(*))."));
|
||||
explainString.contains("No matching function with signature: explode_split(VARCHAR(1), VARCHAR(*))."));
|
||||
}
|
||||
|
||||
// test projection
|
||||
@ -350,8 +350,8 @@ public class TableFunctionPlanTest {
|
||||
explainString.contains("table function: explode_split(concat(`a`.`k2`, ',', `a`.`k3`), ',')"));
|
||||
Assert.assertTrue(explainString.contains("lateral view tuple id: 1"));
|
||||
Assert.assertTrue(explainString.contains("output slot id: 3"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=0, col=k2, colUniqueId=1, type=varchar(1)"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=k3, colUniqueId=2, type=varchar(1)"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=0, col=k2, colUniqueId=1, type=VARCHAR(1)"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=1, col=k3, colUniqueId=2, type=VARCHAR(1)"));
|
||||
}
|
||||
|
||||
// lateral view of subquery
|
||||
@ -368,7 +368,7 @@ public class TableFunctionPlanTest {
|
||||
Assert.assertTrue(explainString.contains("lateral view tuple id: 2"));
|
||||
Assert.assertTrue(explainString.contains("output slot id: 2"));
|
||||
Assert.assertTrue(explainString.contains("tuple ids: 0 2"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=2, col=e1, colUniqueId=-1, type=varchar"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=2, col=e1, colUniqueId=-1, type=VARCHAR"));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -384,7 +384,7 @@ public class TableFunctionPlanTest {
|
||||
Assert.assertTrue(explainString.contains("lateral view tuple id: 3"));
|
||||
Assert.assertTrue(explainString.contains("output slot id: 3"));
|
||||
Assert.assertTrue(explainString.contains("tuple ids: 1 3"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=3, col=e1, colUniqueId=-1, type=varchar"));
|
||||
Assert.assertTrue(explainString.contains("SlotDescriptor{id=3, col=e1, colUniqueId=-1, type=VARCHAR"));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -403,19 +403,19 @@ public class TableFunctionPlanTest {
|
||||
Assert.assertTrue(explainString.contains("tuple ids: 1 3"));
|
||||
String formatString = explainString.replaceAll(" ", "");
|
||||
Assert.assertTrue(formatString.contains(
|
||||
"SlotDescriptor{id=0,col=k1,colUniqueId=0,type=int"
|
||||
"SlotDescriptor{id=0,col=k1,colUniqueId=0,type=INT"
|
||||
));
|
||||
Assert.assertTrue(formatString.contains(
|
||||
"SlotDescriptor{id=1,col=k2,colUniqueId=1,type=varchar(1)"
|
||||
"SlotDescriptor{id=1,col=k2,colUniqueId=1,type=VARCHAR(1)"
|
||||
));
|
||||
Assert.assertTrue(formatString.contains(
|
||||
"SlotDescriptor{id=2,col=k1,colUniqueId=0,type=int"
|
||||
"SlotDescriptor{id=2,col=k1,colUniqueId=0,type=INT"
|
||||
));
|
||||
Assert.assertTrue(formatString.contains(
|
||||
"SlotDescriptor{id=3,col=null,colUniqueId=null,type=varchar"
|
||||
"SlotDescriptor{id=3,col=null,colUniqueId=null,type=VARCHAR"
|
||||
));
|
||||
Assert.assertTrue(formatString.contains(
|
||||
"SlotDescriptor{id=6,col=e1,colUniqueId=-1,type=varchar"
|
||||
"SlotDescriptor{id=6,col=e1,colUniqueId=-1,type=VARCHAR"
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user