fix : test error

This commit is contained in:
liyang830 2022-06-18 17:13:50 +08:00
parent c7a85d565c
commit 701c687e79
2 changed files with 5 additions and 3 deletions

View File

@ -129,7 +129,6 @@ void DatabaseOrdinary::loadStoredObjects(
const auto & name = name_with_path_and_query.first;
const auto & path = name_with_path_and_query.second.path;
const auto & ast = name_with_path_and_query.second.ast;
FunctionNameNormalizer().visit(ast.get());
const auto & create_query = ast->as<const ASTCreateQuery &>();
if (!create_query.is_dictionary)
@ -169,6 +168,7 @@ void DatabaseOrdinary::loadTablesMetadata(ContextPtr local_context, ParsedTables
auto ast = parseQueryFromMetadata(log, getContext(), full_path.string(), /*throw_on_error*/ true, /*remove_empty*/ false);
if (ast)
{
FunctionNameNormalizer().visit(ast.get());
auto * create_query = ast->as<ASTCreateQuery>();
create_query->setDatabase(database_name);

View File

@ -20,12 +20,13 @@ def replace_substring_to_substr(node):
@pytest.mark.parametrize("engine", ['Ordinary', 'Atomic'])
def test_attach_substr(started_cluster, engine):
# Initialize
node.query("DROP TABLE IF EXISTS default.file")
node.query("CREATE TABLE default.file(`s` String, `n` UInt8) ENGINE = MergeTree PARTITION BY substring(s, 1, 2) ORDER BY n ")
# Detach table file
node.query("DETACH TABLE file")
# Replace subtring to substr
# Replace substring to substr
replace_substring_to_substr(node)
# Attach table file
@ -34,9 +35,10 @@ def test_attach_substr(started_cluster, engine):
@pytest.mark.parametrize("engine", ['Ordinary', 'Atomic'])
def test_attach_substr_restart(started_cluster, engine):
# Initialize
node.query("DROP TABLE IF EXISTS default.file")
node.query("CREATE TABLE default.file(`s` String, `n` UInt8) ENGINE = MergeTree PARTITION BY substring(s, 1, 2) ORDER BY n ")
# Replace subtring to substr
# Replace substring to substr
replace_substring_to_substr(node)
# Restart clickhouse