mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-18 12:22:12 +00:00
97f2a2213e
* Move some code outside dbms/src folder * Fix paths
25 lines
706 B
C++
25 lines
706 B
C++
#include <gtest/gtest.h>
|
|
|
|
#include <Interpreters/QueryNormalizer.h>
|
|
#include <Parsers/IAST.h>
|
|
#include <Parsers/queryToString.h>
|
|
#include <Parsers/ExpressionListParsers.h>
|
|
#include <Parsers/parseQuery.h>
|
|
|
|
using namespace DB;
|
|
|
|
TEST(QueryNormalizer, SimpleCycleAlias)
|
|
{
|
|
String query = "a as b, b as a";
|
|
ParserExpressionList parser(false);
|
|
ASTPtr ast = parseQuery(parser, query, 0);
|
|
|
|
Aliases aliases;
|
|
aliases["a"] = parseQuery(parser, "b as a", 0)->children[0];
|
|
aliases["b"] = parseQuery(parser, "a as b", 0)->children[0];
|
|
|
|
Settings settings;
|
|
QueryNormalizer::Data normalizer_data(aliases, settings);
|
|
EXPECT_THROW(QueryNormalizer(normalizer_data).visit(ast), Exception);
|
|
}
|