Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion META.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pg_roaringbitmap",
"abstract": "A Roaring Bitmap data type",
"description": "This library contains a single PostgreSQL extension, a Roaring Bitmap data type called 'roaringbitmap', along with some convenience opperators and functions for constructing and handling Roaring Bitmap.",
"description": "This library contains a single PostgreSQL extension, a Roaring Bitmap data type called 'roaringbitmap', along with some convenience operators and functions for constructing and handling Roaring Bitmaps.",
"version": "1.1.0",
"maintainer": [
"Chen Huajun <chjischj@163.com>"
Expand Down
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# pg_roaringbitmap
RoaringBitmap extension for PostgreSQL.

It's initial based on https://github.com/zeromax007/gpdb-roaringbitmap.
This is originally based on https://github.com/zeromax007/gpdb-roaringbitmap.


# Introduction
Roaring bitmaps are compressed bitmaps which tend to outperform conventional compressed bitmaps such as WAH, EWAH or Concise. In some instances, roaring bitmaps can be hundreds of times faster and they often offer significantly better compression. They can even be faster than uncompressed bitmaps. More information https://github.com/RoaringBitmap/CRoaring.
Roaring bitmaps are compressed bitmaps which tend to outperform conventional compressed bitmaps such as WAH, EWAH or Concise. In some instances, roaring bitmaps can be hundreds of times faster and they often offer significantly better compression. They can even be faster than uncompressed bitmaps. More information at https://github.com/RoaringBitmap/CRoaring.


# Build
Expand All @@ -23,7 +23,7 @@ Note: The regression testing before the version release only covers PostgreSQL 1
sudo make install
psql -c "create extension roaringbitmap"

Note:You can use `make -f Makefile_native` instead of `make` to let the compiler use the SIMD instructions if it's supported by your CPU. In some scenarios, it may double the performance. But if you copy the `pg_roaringbitmap` binary which builded on machine with SIMD support to other machine without SIMD and run, you could get a SIGILL crash.
Note: You can use `make -f Makefile_native` instead of `make` to let the compiler use SIMD instructions if your CPU supports them. In some scenarios, it may double the performance. But if you use the `pg_roaringbitmap` binary built with SIMD support on a machine without SIMD support, you could get a SIGILL crash.

## Test

Expand All @@ -34,13 +34,13 @@ Note:You can use `make -f Makefile_native` instead of `make` to let the compiler
## roaringbitmap
### about roaringbitmap data type

Logically, you could think of roaringbitmap data type as `bit(4294967296)`, and it should be noted that
the integers added to bitmaps is considered to be unsigned. Within bitmaps, numbers are ordered according to uint32. We order the numbers like 0, 1, ..., 2147483647, -2147483648, -2147483647,..., -1. But we use bigint to
Logically, you could think of the roaringbitmap data type as `bit(4294967296)`, and it should be noted that
the integers added to bitmaps are considered to be unsigned. Within bitmaps, numbers are ordered according to uint32. We order the numbers like 0, 1, ..., 2147483647, -2147483648, -2147483647,..., -1. But we use bigint to
reference the range of these integers, that is [0 4294967296).

### input and ouput

Support two kind of input/output syntax 'array' and 'bytea',
Two kinds of input/output syntax are supported: 'array' and 'bytea'.
The default output format is 'bytea'.

postgres=# select roaringbitmap('{1,100,10}');
Expand All @@ -58,7 +58,7 @@ or
(1 row)


output format can changed by `roaringbitmap.output_format`
The output format can changed with `roaringbitmap.output_format`

postgres=# set roaringbitmap.output_format='bytea';
SET
Expand Down Expand Up @@ -118,10 +118,10 @@ or

SELECT rb_iterate('{1,2,3}'::roaringbitmap);

### Opperator List
### Operator List
<table>
<thead>
<th>Opperator</th>
<th>Operator</th>
<th>Input</th>
<th>Output</th>
<th>Desc</th>
Expand Down Expand Up @@ -280,7 +280,7 @@ or
<td><code>rb_index</code></td>
<td><code>roaringbitmap,integer</code></td>
<td><code>bigint</code></td>
<td>Return the 0-based index of element in this roaringbitmap, or -1 if do not exist</td>
<td>Return the 0-based index of the element in this roaringbitmap, or -1 if not present</td>
<td><code>rb_index('{1,2,3}',3)</code></td>
<td><code>2</code></td>
</tr>
Expand Down Expand Up @@ -425,7 +425,7 @@ or
<td><code>roaringbitmap</code></td>
<td><code>SET of integer</code></td>
<td>Return set of integer from a roaringbitmap data.</td>
<td><pre>rb_iterate(roaringbitmap('{1,2,3}'))</pre></td>
<td><code>rb_iterate(roaringbitmap('{1,2,3}'))</code></td>
<td><pre>1
2
3</pre></td>
Expand Down Expand Up @@ -523,13 +523,13 @@ or
### about roaringbitmap64 data type

​​roaringbitmap64​​ is a 64-bit Roaring bitmap implementation, and its format definition can be found in https://github.com/RoaringBitmap/RoaringFormatSpec.
Logically, you could think of roaringbitmap64 data type as `bit(18446744073709551615)` just like roaringbitmap, and it should be noted that
the bigint data added to bitmaps is considered to be unsigned. Within 64 bit bitmaps, numbers are ordered according to uint64.
Logically, you could think of the roaringbitmap64 data type as `bit(18446744073709551615)` just like roaringbitmap, and it should be noted that
the bigint data added to bitmaps are considered to be unsigned. Within 64 bit bitmaps, numbers are ordered according to uint64.
We order the numbers like 0, 1, ..., 9223372036854775807, -9223372036854775808, -9223372036854775807,..., -1.

### input and ouput

Support two kind of input/output syntax 'array' and 'bytea',
Two kinds of input/output syntax are supported: 'array' and 'bytea'.
The default output format is 'bytea'.

postgres=# select roaringbitmap64('{1,100,10}');
Expand All @@ -548,7 +548,7 @@ or
(1 row)


output format can changed by `roaringbitmap.output_format`
The output format can changed with `roaringbitmap.output_format`

postgres=# set roaringbitmap.output_format='bytea';
SET
Expand Down Expand Up @@ -608,10 +608,10 @@ or

SELECT rb64_iterate('{1,2,3}'::roaringbitmap64);

### Opperator List
### Operator List
<table>
<thead>
<th>Opperator</th>
<th>Operator</th>
<th>Input</th>
<th>Output</th>
<th>Desc</th>
Expand Down Expand Up @@ -770,7 +770,7 @@ or
<td><code>rb64_index</code></td>
<td><code>roaringbitmap64,bigint</code></td>
<td><code>bigint</code></td>
<td>Return the 0-based index of element in this roaringbitmap64, or -1 if do not exist</td>
<td>Return the 0-based index of the element in this roaringbitmap64, or -1 if not present</td>
<td><code>rb64_index('{1,2,3}',3)</code></td>
<td><code>2</code></td>
</tr>
Expand Down Expand Up @@ -915,7 +915,7 @@ or
<td><code>roaringbitmap64</code></td>
<td><code>SET of bigint</code></td>
<td>Return set of bigint from a roaringbitmap64 data.</td>
<td><pre>rb64_iterate(roaringbitmap64('{1,2,3}'))</pre></td>
<td><code>rb64_iterate(roaringbitmap64('{1,2,3}'))</code></td>
<td><pre>1
2
3</pre></td>
Expand Down
2 changes: 1 addition & 1 deletion expected/roaringbitmap.out
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ select roaringbitmap('\x11'::bytea);
ERROR: bitmap format is error
select '\x11'::bytea::roaringbitmap;
ERROR: bitmap format is error
-- Test Opperator
-- Test Operator
select roaringbitmap('{}') & roaringbitmap('{}');
?column?
----------
Expand Down
2 changes: 1 addition & 1 deletion expected/roaringbitmap64.out
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ select roaringbitmap64('{0,1,9999,2147483648,-2147483648,-2,-1}')::roaringbitmap
ERROR: value "2147483648" is out of range for type integer
select roaringbitmap64('{0,1,9999,2147483647,-2147483649,-2,-1}')::roaringbitmap;
ERROR: value "-2147483649" is out of range for type integer
-- Test Opperator
-- Test Operator
select roaringbitmap64('{}') & roaringbitmap64('{}');
?column?
----------
Expand Down
2 changes: 1 addition & 1 deletion sql/roaringbitmap.sql
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ select roaringbitmap('{1,9999,-88888}'::roaringbitmap::bytea);
select roaringbitmap('\x11'::bytea);
select '\x11'::bytea::roaringbitmap;

-- Test Opperator
-- Test Operator

select roaringbitmap('{}') & roaringbitmap('{}');
select roaringbitmap('{}') & roaringbitmap('{3,4,5}');
Expand Down
2 changes: 1 addition & 1 deletion sql/roaringbitmap64.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ select '\x11'::bytea::roaringbitmap64;
select roaringbitmap64('{0,1,9999,2147483648,-2147483648,-2,-1}')::roaringbitmap;
select roaringbitmap64('{0,1,9999,2147483647,-2147483649,-2,-1}')::roaringbitmap;

-- Test Opperator
-- Test Operator

select roaringbitmap64('{}') & roaringbitmap64('{}');
select roaringbitmap64('{}') & roaringbitmap64('{3,4,5}');
Expand Down