renamed bitmapRange to bitmapSubsetInRange

This commit is contained in:
Zhichang Yu 2019-08-05 10:27:12 +08:00
parent 09edfaf49c
commit e1f3ef2115
5 changed files with 22 additions and 22 deletions

View File

@ -9,7 +9,7 @@ void registerFunctionsBitmap(FunctionFactory & factory)
{
factory.registerFunction<FunctionBitmapBuild>();
factory.registerFunction<FunctionBitmapToArray>();
factory.registerFunction<FunctionBitmapRange>();
factory.registerFunction<FunctionBitmapSubsetInRange>();
factory.registerFunction<FunctionBitmapSelfCardinality>();
factory.registerFunction<FunctionBitmapAndCardinality>();

View File

@ -30,8 +30,8 @@ namespace ErrorCodes
* Convert bitmap to integer array:
* bitmapToArray: bitmap -> integer[]
*
* Return new set with specified range (not include the range_end):
* bitmapRange: bitmap,integer,integer -> bitmap
* Return subset in specified range (not include the range_end):
* bitmapSubsetInRange: bitmap,integer,integer -> bitmap
*
* Two bitmap and calculation:
* bitmapAnd: bitmap,bitmap -> bitmap
@ -243,12 +243,12 @@ private:
}
};
class FunctionBitmapRange : public IFunction
class FunctionBitmapSubsetInRange : public IFunction
{
public:
static constexpr auto name = "bitmapRange";
static constexpr auto name = "bitmapSubsetInRange";
static FunctionPtr create(const Context &) { return std::make_shared<FunctionBitmapRange>(); }
static FunctionPtr create(const Context &) { return std::make_shared<FunctionBitmapSubsetInRange>(); }
String getName() const override { return name; }

View File

@ -193,21 +193,21 @@ select bitmapContains(bitmapBuild([
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,
100,200,500]),toUInt32(500));
-- bitmapRange:
-- bitmapSubsetInRange:
---- Empty
SELECT bitmapToArray(bitmapRange(bitmapBuild(emptyArrayUInt32()), toUInt32(0), toUInt32(10)));
SELECT bitmapToArray(bitmapRange(bitmapBuild(emptyArrayUInt16()), toUInt32(0), toUInt32(10)));
SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild(emptyArrayUInt32()), toUInt32(0), toUInt32(10)));
SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild(emptyArrayUInt16()), toUInt32(0), toUInt32(10)));
---- Small
select bitmapToArray(bitmapRange(bitmapBuild([1,5,7,9]), toUInt32(0), toUInt32(4)));
select bitmapToArray(bitmapRange(bitmapBuild([1,5,7,9]), toUInt32(10), toUInt32(10)));
select bitmapToArray(bitmapRange(bitmapBuild([1,5,7,9]), toUInt32(3), toUInt32(7)));
select bitmapToArray(bitmapSubsetInRange(bitmapBuild([1,5,7,9]), toUInt32(0), toUInt32(4)));
select bitmapToArray(bitmapSubsetInRange(bitmapBuild([1,5,7,9]), toUInt32(10), toUInt32(10)));
select bitmapToArray(bitmapSubsetInRange(bitmapBuild([1,5,7,9]), toUInt32(3), toUInt32(7)));
---- Large
select bitmapToArray(bitmapRange(bitmapBuild([
select bitmapToArray(bitmapSubsetInRange(bitmapBuild([
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,
100,200,500]), toUInt32(0), toUInt32(100)));
select bitmapToArray(bitmapRange(bitmapBuild([
select bitmapToArray(bitmapSubsetInRange(bitmapBuild([
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,
100,200,500]), toUInt32(30), toUInt32(200)));
select bitmapToArray(bitmapRange(bitmapBuild([
select bitmapToArray(bitmapSubsetInRange(bitmapBuild([
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,
100,200,500]), toUInt32(100), toUInt32(200)));

View File

@ -56,12 +56,12 @@ SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res
└─────────────┘
```
## bitmapRange {#bitmap_functions-bitmaprange}
## bitmapSubsetInRange {#bitmap_functions-bitmapsubsetinrange}
Return new set with specified range (not include the range_end).
Return subset in specified range (not include the range_end).
```
bitmapRange(bitmap, range_start, range_end)
bitmapSubsetInRange(bitmap, range_start, range_end)
```
**Parameters**
@ -73,7 +73,7 @@ bitmapRange(bitmap, range_start, range_end)
**Example**
``` sql
SELECT bitmapToArray(bitmapRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res
SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res
```
```

View File

@ -51,12 +51,12 @@ SELECT bitmapToArray(bitmapBuild([1, 2, 3, 4, 5])) AS res
└─────────────┘
```
## bitmapRange
## bitmapSubsetInRange
将位图指定范围不包含range_end转换为另一个位图。
```
bitmapRange(bitmap, range_start, range_end)
bitmapSubsetInRange(bitmap, range_start, range_end)
```
**参数**
@ -68,7 +68,7 @@ bitmapRange(bitmap, range_start, range_end)
**示例**
``` sql
SELECT bitmapToArray(bitmapRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res
SELECT bitmapToArray(bitmapSubsetInRange(bitmapBuild([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,100,200,500]), toUInt32(30), toUInt32(200))) AS res
```
```