Fix build

This commit is contained in:
Nikolay Degterinsky 2021-09-13 17:18:04 +03:00
parent f3f23cb905
commit 9199b100ee
3 changed files with 17 additions and 17 deletions

View File

@ -214,7 +214,7 @@ void DatabaseOnDisk::createTable(
{
const auto & settings = local_context->getSettingsRef();
const auto & create = query->as<ASTCreateQuery &>();
assert(table_name == create.table);
assert(table_name == create.getTable());
/// Create a file with metadata if necessary - if the query is not ATTACH.
/// Write the query of `ATTACH table` to it.
@ -678,7 +678,7 @@ ASTPtr DatabaseOnDisk::parseQueryFromMetadata(
"File {} contains both UUID and table name. Will use name `{}` instead of `{}`",
metadata_file_path,
table_name,
create.table);
create.getTable());
create.setTable(table_name);
}

View File

@ -247,7 +247,7 @@ bool tryGetIdentifierNameInto(const IAST * ast, String & name)
const String & getIdentifierNameRef(const IAST * ast)
{
static const String empty = "";
static const String empty;
if (ast)
{

View File

@ -42,8 +42,8 @@ TEST(ParserDictionaryDDL, SimpleDictionary)
ParserCreateDictionaryQuery parser;
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0, 0);
ASTCreateQuery * create = ast->as<ASTCreateQuery>();
EXPECT_EQ(create->table, "dict1");
EXPECT_EQ(create->database, "test");
EXPECT_EQ(create->getTable(), "dict1");
EXPECT_EQ(create->getDatabase(), "test");
EXPECT_EQ(create->is_dictionary, true);
EXPECT_NE(create->dictionary, nullptr);
EXPECT_NE(create->dictionary->lifetime, nullptr);
@ -138,8 +138,8 @@ TEST(ParserDictionaryDDL, AttributesWithMultipleProperties)
ParserCreateDictionaryQuery parser;
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0, 0);
ASTCreateQuery * create = ast->as<ASTCreateQuery>();
EXPECT_EQ(create->table, "dict2");
EXPECT_EQ(create->database, "");
EXPECT_EQ(create->getTable(), "dict2");
EXPECT_EQ(create->getDatabase(), "");
/// test attributes
EXPECT_NE(create->dictionary_attributes_list, nullptr);
@ -240,8 +240,8 @@ TEST(ParserDictionaryDDL, NestedSource)
ParserCreateDictionaryQuery parser;
ASTPtr ast = parseQuery(parser, input.data(), input.data() + input.size(), "", 0, 0);
ASTCreateQuery * create = ast->as<ASTCreateQuery>();
EXPECT_EQ(create->table, "dict4");
EXPECT_EQ(create->database, "");
EXPECT_EQ(create->getTable(), "dict4");
EXPECT_EQ(create->getDatabase(), "");
/// source test
EXPECT_EQ(create->dictionary->source->name, "mysql");
@ -301,8 +301,8 @@ TEST(ParserDictionaryDDL, ParseDropQuery)
ASTDropQuery * drop1 = ast1->as<ASTDropQuery>();
EXPECT_TRUE(drop1->is_dictionary);
EXPECT_EQ(drop1->database, "test");
EXPECT_EQ(drop1->table, "dict1");
EXPECT_EQ(drop1->getDatabase(), "test");
EXPECT_EQ(drop1->getTable(), "dict1");
auto str1 = serializeAST(*drop1, true);
EXPECT_EQ(input1, str1);
@ -312,8 +312,8 @@ TEST(ParserDictionaryDDL, ParseDropQuery)
ASTDropQuery * drop2 = ast2->as<ASTDropQuery>();
EXPECT_TRUE(drop2->is_dictionary);
EXPECT_EQ(drop2->database, "");
EXPECT_EQ(drop2->table, "dict2");
EXPECT_EQ(drop2->getDatabase(), "");
EXPECT_EQ(drop2->getTable(), "dict2");
auto str2 = serializeAST(*drop2, true);
EXPECT_EQ(input2, str2);
}
@ -326,8 +326,8 @@ TEST(ParserDictionaryDDL, ParsePropertiesQueries)
ASTPtr ast1 = parseQuery(parser, input1.data(), input1.data() + input1.size(), "", 0, 0);
ASTShowCreateDictionaryQuery * show1 = ast1->as<ASTShowCreateDictionaryQuery>();
EXPECT_EQ(show1->table, "dict1");
EXPECT_EQ(show1->database, "test");
EXPECT_EQ(show1->getTable(), "dict1");
EXPECT_EQ(show1->getDatabase(), "test");
EXPECT_EQ(serializeAST(*show1), input1);
String input2 = "EXISTS DICTIONARY dict2";
@ -335,7 +335,7 @@ TEST(ParserDictionaryDDL, ParsePropertiesQueries)
ASTPtr ast2 = parseQuery(parser, input2.data(), input2.data() + input2.size(), "", 0, 0);
ASTExistsDictionaryQuery * show2 = ast2->as<ASTExistsDictionaryQuery>();
EXPECT_EQ(show2->table, "dict2");
EXPECT_EQ(show2->database, "");
EXPECT_EQ(show2->getTable(), "dict2");
EXPECT_EQ(show2->getDatabase(), "");
EXPECT_EQ(serializeAST(*show2), input2);
}