Files
scylladb/cql3
Avi Kivity 78f4ee385f cql3: functions: fix count(col) for non-scalar types
count(col), unlike count(*), does not count rows for which col is NULL.
However, if col's data type is not a scalar (e.g. a collection, tuple,
or user-defined type) it behaves like count(*), counting NULLs too.

The cause is that get_dynamic_aggregate() converts count() to
the count(*) version. It works for scalars because get_dynamic_aggregate()
intentionally fails to match scalar arguments, and functions::get() then
matches the arguments against the pre-declared count functions.

As we can only pre-declare count(scalar) (there's an infinite number
of non-scalar types), we change the approach to be the same as min/max:
we make count() a generic function. In fact count(col) is much better
as a generic function, as it only examines its input to see if it is
NULL.

A unit test is added. It passes with Cassandra as well.

Fixes #14198.

Closes #14199
2023-06-13 14:40:14 +03:00
..
2023-02-28 22:26:43 +02:00
2023-04-29 13:11:31 +02:00
2023-01-18 10:38:24 +02:00
2023-06-12 10:41:04 +03:00
2023-06-12 10:41:04 +03:00
2023-06-12 10:41:04 +03:00
2023-04-26 14:09:58 +08:00
2023-01-18 10:38:24 +02:00
2023-06-12 10:41:04 +03:00
2023-04-28 16:59:29 +08:00
2023-02-19 21:05:45 +02:00