mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Implement AggregateFunctionCountNotNullUnary::addBatchSinglePlace
This commit is contained in:
parent
b39c19399f
commit
a22f7c159e
@ -203,6 +203,21 @@ public:
|
||||
data(place).count += !assert_cast<const ColumnNullable &>(*columns[0]).isNullAt(row_num);
|
||||
}
|
||||
|
||||
void addBatchSinglePlace(
|
||||
size_t batch_size, AggregateDataPtr place, const IColumn ** columns, Arena *, ssize_t if_argument_pos) const override
|
||||
{
|
||||
auto & nc = assert_cast<const ColumnNullable &>(*columns[0]);
|
||||
if (if_argument_pos >= 0)
|
||||
{
|
||||
const auto & flags = assert_cast<const ColumnUInt8 &>(*columns[if_argument_pos]).getData();
|
||||
data(place).count += countBytesInFilterWithNull(flags, nc.getNullMapData().data());
|
||||
}
|
||||
else
|
||||
{
|
||||
data(place).count += batch_size - countBytesInFilter(nc.getNullMapData().data(), batch_size);
|
||||
}
|
||||
}
|
||||
|
||||
void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, Arena *) const override
|
||||
{
|
||||
data(place).count += data(rhs).count;
|
||||
|
@ -4,6 +4,8 @@
|
||||
<fill_query>INSERT INTO data SELECT number, 1 from numbers(10000000)</fill_query>
|
||||
|
||||
<query tag='count_10M' short='1'>SELECT count() FROM data</query>
|
||||
<query>SELECT count(k) FROM data</query>
|
||||
<query>SELECT count(toNullable(k)) FROM data</query>
|
||||
|
||||
<drop_query>DROP TABLE IF EXISTS data</drop_query>
|
||||
</test>
|
||||
|
@ -1,3 +1,21 @@
|
||||
<test>
|
||||
<query>SELECT countIf(number % 2) FROM numbers(100000000)</query>
|
||||
|
||||
<query>
|
||||
SELECT countIf(key IS NOT NULL)
|
||||
FROM
|
||||
(
|
||||
SELECT materialize(toNullable(1)) AS key
|
||||
FROM numbers(100000000)
|
||||
)
|
||||
</query>
|
||||
|
||||
<query>
|
||||
SELECT countIf(key IS NOT NULL)
|
||||
FROM
|
||||
(
|
||||
SELECT materialize(CAST(NULL, 'Nullable(Int8)')) AS key
|
||||
FROM numbers(100000000)
|
||||
)
|
||||
</query>
|
||||
</test>
|
||||
|
Loading…
Reference in New Issue
Block a user