mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Add missing parenthesis for isNotNull/isNull rewrites to IS [NOT] NULL
After #29446 the following query was "broken": select isNotNull(1)+isNotNull(2) from remote('127.2', system.one) This was also a problem for queries to external storages (i.e. mysql), since it also uses query rewrite, like non-local distributed queries. Fixes: #29446
This commit is contained in:
parent
fa1b587635
commit
e1b6acfa52
@ -294,8 +294,12 @@ void ASTFunction::formatImplWithoutAlias(const FormatSettings & settings, Format
|
||||
continue;
|
||||
}
|
||||
|
||||
if (frame.need_parens)
|
||||
settings.ostr << '(';
|
||||
arguments->formatImpl(settings, state, nested_need_parens);
|
||||
settings.ostr << (settings.hilite ? hilite_operator : "") << func[1] << (settings.hilite ? hilite_none : "");
|
||||
if (frame.need_parens)
|
||||
settings.ostr << ')';
|
||||
|
||||
written = true;
|
||||
|
||||
|
@ -7,3 +7,8 @@ explain syntax select isNull(null);
|
||||
SELECT NULL IS NULL
|
||||
explain syntax select isNotNull(null);
|
||||
SELECT NULL IS NOT NULL
|
||||
explain syntax select isNotNull(1)+isNotNull(2) from remote('127.2', system.one);
|
||||
SELECT (1 IS NOT NULL) + (2 IS NOT NULL)
|
||||
FROM remote(\'127.2\', \'system.one\')
|
||||
select isNotNull(1)+isNotNull(2) from remote('127.2', system.one);
|
||||
2
|
||||
|
@ -3,3 +3,5 @@ explain syntax select null is null;
|
||||
explain syntax select null is not null;
|
||||
explain syntax select isNull(null);
|
||||
explain syntax select isNotNull(null);
|
||||
explain syntax select isNotNull(1)+isNotNull(2) from remote('127.2', system.one);
|
||||
select isNotNull(1)+isNotNull(2) from remote('127.2', system.one);
|
||||
|
Loading…
Reference in New Issue
Block a user