-
Notifications
You must be signed in to change notification settings - Fork 8.3k
-If combinator and NULLs #16231
Copy link
Copy link
Closed
Labels
bugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official releasemajor
Description
Clickhouse version: 20.9.2 revision 54439
SELECT
sumMapIf([1], [1], nullIf(number, 3) > 0) AS col1,
countIf(1, nullIf(number, 3) > 0) AS col2,
sumIf(1, nullIf(number, 3) > 0) AS col3
FROM numbers(1, 5)col1 is expected to be ([1],[4]) as NULLs must be skipped
col3 value is expected to be the same as col2's as the condition part is identical and both should return 4
in fact we get the following values:
┌─col1──────┬─col2─┬─col3─┐
│ ([1],[5]) │ 4 │ 5 │
└───────────┴──────┴──────┘
as a workaround one can wrap the condition part with coalesce(..., 0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official releasemajor