From 9199b100eed4e68f2641e68ab13ca1e2cfcf60b8 Mon Sep 17 00:00:00 2001 From: Nikolay Degterinsky Date: Mon, 13 Sep 2021 17:18:04 +0300 Subject: [PATCH] Fix build --- src/Databases/DatabaseOnDisk.cpp | 4 +-- src/Parsers/ASTIdentifier.cpp | 2 +- src/Parsers/tests/gtest_dictionary_parser.cpp | 28 +++++++++---------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Databases/DatabaseOnDisk.cpp b/src/Databases/DatabaseOnDisk.cpp index f5fdd7bda7f..d8cb8b3d696 100644 --- a/src/Databases/DatabaseOnDisk.cpp +++ b/src/Databases/DatabaseOnDisk.cpp @@ -214,7 +214,7 @@ void DatabaseOnDisk::createTable( { const auto & settings = local_context->getSettingsRef(); const auto & create = query->as(); - 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); } diff --git a/src/Parsers/ASTIdentifier.cpp b/src/Parsers/ASTIdentifier.cpp index 399d1545f14..c328e85d978 100644 --- a/src/Parsers/ASTIdentifier.cpp +++ b/src/Parsers/ASTIdentifier.cpp @@ -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) { diff --git a/src/Parsers/tests/gtest_dictionary_parser.cpp b/src/Parsers/tests/gtest_dictionary_parser.cpp index b051cedfb23..cf31177f4ce 100644 --- a/src/Parsers/tests/gtest_dictionary_parser.cpp +++ b/src/Parsers/tests/gtest_dictionary_parser.cpp @@ -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(); - 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(); - 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(); - 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(); 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(); 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(); - 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(); - EXPECT_EQ(show2->table, "dict2"); - EXPECT_EQ(show2->database, ""); + EXPECT_EQ(show2->getTable(), "dict2"); + EXPECT_EQ(show2->getDatabase(), ""); EXPECT_EQ(serializeAST(*show2), input2); }