Handle empty expression list in cross join

This commit is contained in:
vdimir 2022-04-07 11:32:32 +00:00
parent 69160fa3e3
commit eb7ac4c3a6
No known key found for this signature in database
GPG Key ID: 6EE4CE2BEDC51862
3 changed files with 62 additions and 0 deletions

View File

@ -377,7 +377,11 @@ private:
static void visit(ASTSelectQuery & select, ASTPtr &, Data & data) static void visit(ASTSelectQuery & select, ASTPtr &, Data & data)
{ {
if (!data.done) 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)); select.setExpression(ASTSelectQuery::Expression::SELECT, std::move(data.expression_list));
}
data.done = true; data.done = true;
} }
}; };

View File

@ -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

View File

@ -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;