zeromax007 / gpdb-roaringbitmap

RoaringBitmap extension for greenplum-db
Apache License 2.0
113 stars 31 forks source link

roaringbitmap contain negative integer cause issue #12

Closed zhongyibill closed 4 years ago

zhongyibill commented 4 years ago

SQL: CREATE TABLE t1 (id integer, bitmap roaringbitmap);

INSERT INTO t1 SELECT 3,RB_BUILD(ARRAY[1,2,3]); INSERT INTO t1 SELECT 4,RB_BUILD(ARRAY[3,4,5]); INSERT INTO t1 SELECT 5,RB_BUILD(ARRAY[-3,4,5]);

select id, rb_maximum(bitmap) from t1 where id in (3,4,5); id | rb_maximum ----+------------ 3 | 3 4 | 5 5 | -3

I think it should be select id, rb_maximum(bitmap) from t1 where id in (3,4,5); id | rb_maximum ----+------------ 3 | 3 4 | 5 5 | 5

zeromax007 commented 4 years ago

The negative integer is stored high level offset, the first offset is 0 and the last offset is -1.

zhongyibill commented 4 years ago

I know The negative integer is stored high level offset cause this issue. I think the result return negative is wrong or the roaringbitmap is not support negative?