mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 07:01:59 +00:00
Merge pull request #36033 from vdimir/cross-join-empty-list
This commit is contained in:
commit
265fa90689
@ -182,7 +182,6 @@ struct RewriteTablesVisitorData
|
||||
}
|
||||
};
|
||||
|
||||
template <size_t version = 1>
|
||||
bool needRewrite(ASTSelectQuery & select, std::vector<const ASTTableExpression *> & table_expressions)
|
||||
{
|
||||
if (!select.tables())
|
||||
@ -233,8 +232,6 @@ bool needRewrite(ASTSelectQuery & select, std::vector<const ASTTableExpression *
|
||||
return false;
|
||||
|
||||
/// it's not trivial to support mix of JOIN ON & JOIN USING cause of short names
|
||||
if (num_using && version <= 1)
|
||||
throw Exception("Multiple JOIN does not support USING", ErrorCodes::NOT_IMPLEMENTED);
|
||||
if (num_array_join)
|
||||
throw Exception("Multiple JOIN does not support mix with ARRAY JOINs", ErrorCodes::NOT_IMPLEMENTED);
|
||||
return true;
|
||||
@ -380,7 +377,11 @@ private:
|
||||
static void visit(ASTSelectQuery & select, ASTPtr &, Data & data)
|
||||
{
|
||||
if (!data.done)
|
||||
{
|
||||
if (data.expression_list->children.empty())
|
||||
data.expression_list->children.emplace_back(std::make_shared<ASTAsterisk>());
|
||||
select.setExpression(ASTSelectQuery::Expression::SELECT, std::move(data.expression_list));
|
||||
}
|
||||
data.done = true;
|
||||
}
|
||||
};
|
||||
@ -605,7 +606,7 @@ void JoinToSubqueryTransformMatcher::visit(ASTPtr & ast, Data & data)
|
||||
void JoinToSubqueryTransformMatcher::visit(ASTSelectQuery & select, ASTPtr & ast, Data & data)
|
||||
{
|
||||
std::vector<const ASTTableExpression *> table_expressions;
|
||||
if (!needRewrite<2>(select, table_expressions))
|
||||
if (!needRewrite(select, table_expressions))
|
||||
return;
|
||||
|
||||
auto & src_tables = select.tables()->children;
|
||||
|
@ -0,0 +1,52 @@
|
||||
24
|
||||
24
|
||||
24
|
||||
24 24 24
|
||||
0 0 0
|
||||
0 0 1
|
||||
0 0 2
|
||||
0 0 3
|
||||
0 1 0
|
||||
0 1 1
|
||||
0 1 2
|
||||
0 1 3
|
||||
0 2 0
|
||||
0 2 1
|
||||
0 2 2
|
||||
0 2 3
|
||||
1 0 0
|
||||
1 0 1
|
||||
1 0 2
|
||||
1 0 3
|
||||
1 1 0
|
||||
1 1 1
|
||||
1 1 2
|
||||
1 1 3
|
||||
1 2 0
|
||||
1 2 1
|
||||
1 2 2
|
||||
1 2 3
|
||||
0 0 0
|
||||
0 0 1
|
||||
0 0 2
|
||||
0 0 3
|
||||
0 1 0
|
||||
0 1 1
|
||||
0 1 2
|
||||
0 1 3
|
||||
0 2 0
|
||||
0 2 1
|
||||
0 2 2
|
||||
0 2 3
|
||||
1 0 0
|
||||
1 0 1
|
||||
1 0 2
|
||||
1 0 3
|
||||
1 1 0
|
||||
1 1 1
|
||||
1 1 2
|
||||
1 1 3
|
||||
1 2 0
|
||||
1 2 1
|
||||
1 2 2
|
||||
1 2 3
|
@ -0,0 +1,6 @@
|
||||
SELECT count(1) FROM numbers(2) AS n1, numbers(3) AS n2, numbers(4) AS n3;
|
||||
SELECT count(*) FROM numbers(2) AS n1, numbers(3) AS n2, numbers(4) AS n3;
|
||||
SELECT count() FROM numbers(2) AS n1, numbers(3) AS n2, numbers(4) AS n3;
|
||||
SELECT count(n1.number), count(n2.number), count(n3.number) FROM numbers(2) AS n1, numbers(3) AS n2, numbers(4) AS n3;
|
||||
SELECT * FROM numbers(2) AS n1, numbers(3) AS n2, numbers(4) AS n3 ORDER BY n1.number, n2.number, n3.number;
|
||||
SELECT n1.number, n2.number, n3.number FROM numbers(2) AS n1, numbers(3) AS n2, numbers(4) AS n3 ORDER BY n1.number, n2.number, n3.number;
|
Loading…
Reference in New Issue
Block a user