added groupBitmapAnd, groupBitmapOr, groupBitmapXor#7109
added groupBitmapAnd, groupBitmapOr, groupBitmapXor#7109alexey-milovidov merged 1 commit intoClickHouse:masterfrom infinivision:aggBitmapAnd
Conversation
|
Let's make the names consistent with our existing groupBitAnd, groupBitOr, groupBitXor, groupArray functions (use "group" instead of "agg"): groupBitmapAnd, groupBitmapOr, groupBitmapXor. |
|
@alexey-milovidov Renamed per your suggestion. |
|
Style check does not show any errors after merge. |
|
Simple query |
|
We've also observed a ThreadSanitizer failure in Stress test on current master: Looks more like a use-after-free. |
| void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena *) const override | ||
| { | ||
| Data & data_lhs = this->data(place); | ||
| const Data & data_rhs = this->data(static_cast<const ColumnAggregateFunction &>(*columns[0]).getData()[row_num]); |
There was a problem hiding this comment.
Better to use assert_cast here instead of static_cast, like in other aggregate functions.
There was a problem hiding this comment.
@akuzm I don't see how use-after-free happen at dbms/src/AggregateFunctions/AggregateFunctionGroupBitmap.h:74. Could you help on this?
There was a problem hiding this comment.
@akuzm @abyss7 After replacing static_cast with assert_cast, SELECT groupBitmapOr(31) still crashes the server(segfault at AggregateFunctionGroupBitmap.h:74), but not the debug server(built with cmake -DCMAKE_BUILD_TYPE=Debug .., cli gets error Code: 368. DB::Exception: Received from localhost:9000. DB::Exception: Bad cast from type DB::ColumnVector<unsigned char> to DB::ColumnAggregateFunction. ).
Do you think this change is good enough?
There was a problem hiding this comment.
The error message means that you are casting the column to a wrong type: ColumnVector<usigned char> to ColumnAggregateFunction. The next step would be to correct this wrong cast.
There was a problem hiding this comment.
Fixed #7109 groupBitmapOr(31) segfault
I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en
For changelog. Remove if this is non-significant change.
Category (leave one):
Short description (up to few sentences):
added AND, OR, XOR aggregate function for bitmap column. This is the implementation of #6955.
groupBitmapAnd
Calculations the AND of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return bitmap object.
Parameters
expr– An expression that results inAggregateFunction(groupBitmap, UInt*)type.Return value
Value of the
UInt64type.Example
groupBitmapOr
Calculations the OR of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return bitmap object. This is equivalent to
groupBitmapMerge.Parameters
expr– An expression that results inAggregateFunction(groupBitmap, UInt*)type.Return value
Value of the
UInt64type.Example
groupBitmapXor
Calculations the XOR of a bitmap column, return cardinality of type UInt64, if add suffix -State, then return bitmap object.
Parameters
expr– An expression that results inAggregateFunction(groupBitmap, UInt*)type.Return value
Value of the
UInt64type.Example