mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
Fix unit-tests again
This commit is contained in:
parent
977fbbf1e4
commit
7aa08a04b5
@ -242,7 +242,7 @@ static inline bool parseRenameCommand(IParser::Pos & pos, ASTPtr & node, Expecte
|
||||
}
|
||||
else if (ParserKeyword("TO").ignore(pos, expected) || ParserKeyword("AS").ignore(pos, expected))
|
||||
{
|
||||
if (!ParserCompoundIdentifier(false).parse(pos, new_name, expected))
|
||||
if (!ParserCompoundIdentifier(true).parse(pos, new_name, expected))
|
||||
return false;
|
||||
|
||||
auto new_table_id = new_name->as<ASTTableIdentifier>()->getTableId();
|
||||
|
@ -36,7 +36,7 @@ bool ParserAlterQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, Expected & e
|
||||
if (!ParserKeyword("ALTER TABLE").ignore(pos, expected))
|
||||
return false;
|
||||
|
||||
if (!ParserCompoundIdentifier(false).parse(pos, table, expected))
|
||||
if (!ParserCompoundIdentifier(true).parse(pos, table, expected))
|
||||
return false;
|
||||
|
||||
if (!ParserList(std::make_unique<ParserAlterCommand>(), std::make_unique<ParserToken>(TokenType::Comma)).parse(pos, command_list, expected))
|
||||
|
@ -68,14 +68,14 @@ bool ParserCreateQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
|
||||
if (ParserKeyword("LIKE").ignore(pos, expected))
|
||||
{
|
||||
if (!ParserCompoundIdentifier(false).parse(pos, like_table, expected))
|
||||
if (!ParserCompoundIdentifier(true).parse(pos, like_table, expected))
|
||||
return false;
|
||||
}
|
||||
else if (ParserToken(TokenType::OpeningRoundBracket).ignore(pos, expected))
|
||||
{
|
||||
if (ParserKeyword("LIKE").ignore(pos, expected))
|
||||
{
|
||||
if (!ParserCompoundIdentifier(false).parse(pos, like_table, expected))
|
||||
if (!ParserCompoundIdentifier(true).parse(pos, like_table, expected))
|
||||
return false;
|
||||
|
||||
if (!ParserToken(TokenType::ClosingRoundBracket).ignore(pos, expected))
|
||||
|
@ -176,7 +176,7 @@ TEST(TransformQueryForExternalDatabase, MultipleAndSubqueries)
|
||||
R"(SELECT "column" FROM "test"."table" WHERE 1 AND ("column" = 42) AND ("column" IN (1, 42)) AND ("column" != 4))");
|
||||
check(state, 1,
|
||||
"SELECT column FROM test.table WHERE toString(column) = '42' AND left(column, 10) = RIGHT(column, 10) AND column = 42",
|
||||
R"(SELECT "column" FROM "test"."table" WHERE ("column" = 42))");
|
||||
R"(SELECT "column" FROM "test"."table" WHERE "column" = 42)");
|
||||
}
|
||||
|
||||
TEST(TransformQueryForExternalDatabase, Issue7245)
|
||||
|
@ -273,20 +273,15 @@ String transformQueryForExternalDatabase(
|
||||
{
|
||||
if (function->name == "and")
|
||||
{
|
||||
bool compatible_found = false;
|
||||
auto new_function_and = makeASTFunction("and");
|
||||
for (const auto & elem : function->arguments->children)
|
||||
{
|
||||
if (isCompatible(*elem))
|
||||
{
|
||||
new_function_and->arguments->children.push_back(elem);
|
||||
compatible_found = true;
|
||||
}
|
||||
}
|
||||
if (new_function_and->arguments->children.size() == 1)
|
||||
new_function_and->name = "";
|
||||
|
||||
if (compatible_found)
|
||||
select->setExpression(ASTSelectQuery::Expression::WHERE, std::move(new_function_and->arguments->children[0]));
|
||||
else if (new_function_and->arguments->children.size() > 1)
|
||||
select->setExpression(ASTSelectQuery::Expression::WHERE, std::move(new_function_and));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user