mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 18:12:02 +00:00
Fix normalize ASTSelectWithUnionQuery strip FORMAT of the query
This commit is contained in:
parent
749412bfeb
commit
fda36deec3
@ -29,7 +29,13 @@ void NormalizeSelectWithUnionQueryMatcher::getSelectsFromUnionListNode(ASTPtr as
|
|||||||
void NormalizeSelectWithUnionQueryMatcher::visit(ASTPtr & ast, Data & data)
|
void NormalizeSelectWithUnionQueryMatcher::visit(ASTPtr & ast, Data & data)
|
||||||
{
|
{
|
||||||
if (auto * select_union = ast->as<ASTSelectWithUnionQuery>())
|
if (auto * select_union = ast->as<ASTSelectWithUnionQuery>())
|
||||||
|
{
|
||||||
|
/// The rewrite of ASTSelectWithUnionQuery may strip the format info, so
|
||||||
|
/// we need to keep and restore it.
|
||||||
|
auto format = select_union->format;
|
||||||
visit(*select_union, data);
|
visit(*select_union, data);
|
||||||
|
select_union->format = format;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NormalizeSelectWithUnionQueryMatcher::visit(ASTSelectWithUnionQuery & ast, Data & data)
|
void NormalizeSelectWithUnionQueryMatcher::visit(ASTSelectWithUnionQuery & ast, Data & data)
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
┌─[1m1[0m─┐
|
||||||
|
│ 1 │
|
||||||
|
│ 2 │
|
||||||
|
└───┘
|
7
tests/queries/0_stateless/02896_union_distinct_http_format.sh
Executable file
7
tests/queries/0_stateless/02896_union_distinct_http_format.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||||
|
# shellcheck source=../shell_config.sh
|
||||||
|
. "$CURDIR"/../shell_config.sh
|
||||||
|
|
||||||
|
echo 'SELECT 1 UNION DISTINCT SELECT 2 FORMAT PrettyCompactMonoBlock' | curl 'http://localhost:8123/' --data-binary @-
|
Loading…
Reference in New Issue
Block a user