Skip to content

Commit f08c13a

Browse files
Fix incomplete query result for UNION in view() function.
1 parent 1267246 commit f08c13a

File tree

4 files changed

+3
-2
lines changed

4 files changed

+3
-2
lines changed

src/Interpreters/NormalizeSelectWithUnionQueryVisitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void NormalizeSelectWithUnionQueryMatcher::getSelectsFromUnionListNode(ASTPtr as
2828

2929
void NormalizeSelectWithUnionQueryMatcher::visit(ASTPtr & ast, Data & data)
3030
{
31-
if (auto * select_union = ast->as<ASTSelectWithUnionQuery>())
31+
if (auto * select_union = ast->as<ASTSelectWithUnionQuery>(); select_union && !select_union->is_normalized)
3232
{
3333
/// The rewrite of ASTSelectWithUnionQuery may strip the format info, so
3434
/// we need to keep and restore it.

tests/analyzer_tech_debt.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
02345_implicit_transaction
3939
02352_grouby_shadows_arg
4040
02354_annoy
41-
02366_union_decimal_conversion
4241
02375_rocksdb_with_filters
4342
02402_merge_engine_with_view
4443
02404_memory_bound_merging

tests/queries/0_stateless/00612_union_query_with_subquery.reference

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
1
1111
1
1212
2
13+
3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
SELECT * FROM ((SELECT * FROM system.numbers LIMIT 1) UNION ALL SELECT * FROM system.numbers LIMIT 2 UNION ALL (SELECT * FROM system.numbers LIMIT 3)) ORDER BY number;
22
SELECT * FROM (SELECT * FROM system.numbers LIMIT 1 UNION ALL (SELECT * FROM system.numbers LIMIT 2 UNION ALL (SELECT * FROM system.numbers LIMIT 3))) ORDER BY number;
3+
select count() from view(select 1 union all (select 2 union all select 3));

0 commit comments

Comments
 (0)