ISSUES-4006 try fix test failure & add some test

This commit is contained in:
zhang2014 2020-08-09 22:55:58 +08:00
parent 933f287db4
commit 90b7628496
2 changed files with 8 additions and 3 deletions

View File

@ -161,7 +161,12 @@ TEST(ParserAlterCommand, RenameAlterCommand)
ast = tryParserQuery(alter_p, "RENAME TO new_table_name");
EXPECT_EQ(ast->as<ASTAlterCommand>()->type, ASTAlterCommand::RENAME_TABLE);
EXPECT_EQ(ast->as<ASTAlterCommand>()->index_name, "new_table_name");
EXPECT_EQ(ast->as<ASTAlterCommand>()->new_table_name, "new_table_name");
ast = tryParserQuery(alter_p, "RENAME TO new_database_name.new_table_name");
EXPECT_EQ(ast->as<ASTAlterCommand>()->type, ASTAlterCommand::RENAME_TABLE);
EXPECT_EQ(ast->as<ASTAlterCommand>()->new_table_name, "new_table_name");
EXPECT_EQ(ast->as<ASTAlterCommand>()->new_database_name, "new_database_name");
}
TEST(ParserAlterCommand, ModifyAlterCommand)

View File

@ -301,7 +301,7 @@ def alter_rename_table_with_materialize_mysql_database(clickhouse_node, mysql_no
mysql_node.query("CREATE DATABASE test_database DEFAULT CHARACTER SET 'utf8'")
mysql_node.query("CREATE TABLE test_database.test_table_1 (id INT NOT NULL PRIMARY KEY, drop_column INT) ENGINE = InnoDB;")
mysql_node.query("ALTER TABLE test_database.test_table_1 DROP COLUMN drop_column, RENAME TO test_database.test_table_2, RENAME TO test_table_3")
mysql_node.query("ALTER TABLE test_database.test_table_1 DROP COLUMN drop_column, RENAME TO test_database.test_table_2, RENAME TO test_database.test_table_3")
# create mapping
clickhouse_node.query(
@ -313,7 +313,7 @@ def alter_rename_table_with_materialize_mysql_database(clickhouse_node, mysql_no
mysql_node.query("CREATE TABLE test_database.test_table_1 (id INT NOT NULL PRIMARY KEY, drop_column INT NOT NULL) ENGINE = InnoDB;")
check_query(clickhouse_node, "SHOW TABLES FROM test_database FORMAT TSV", "test_table_1\ntest_table_3\n")
check_query(clickhouse_node, "DESC test_database.test_table_1 FORMAT TSV", "id\tInt32\t\t\t\t\t\ndrop_column\tInt32\t\t\t\t\t\n")
mysql_node.query("ALTER TABLE test_database.test_table_1 DROP COLUMN drop_column, RENAME TO test_table_2, RENAME TO test_database.test_table_4")
mysql_node.query("ALTER TABLE test_database.test_table_1 DROP COLUMN drop_column, RENAME TO test_database.test_table_2, RENAME TO test_database.test_table_4")
check_query(clickhouse_node, "SHOW TABLES FROM test_database FORMAT TSV", "test_table_3\ntest_table_4\n")
check_query(clickhouse_node, "DESC test_database.test_table_4 FORMAT TSV", "id\tInt32\t\t\t\t\t\n")