dynamobi/dynamobi — Issue #151: [LDB-171] Large gaps in between rids in a bitmap index entry causes incorrect query results when the index is used
Author: dynamobi-build
Created: 2011-12-30 02:17:05+00:00
State: open
Labels: LBM, LDB

[reporter="jvs", created="Fri, 29 Feb 2008 12:46:01 -0500 (GMT-05:00)"]
Cloned from Zelaine's comments in LER-7362:

If you have an index defined on a column in a table, and a particular value in that column is associated with rid N and rId N+M, where M >= ((2^24)+1)*8 = 134,217,736, then the encoding of rid N+M within that bitmap entry is incorrect. This will then result in incorrect query results if you select from that table, filtering on the index column with the value associated with rids N and N+M.

This problem was found by an external user testing LucidDB. I was able to reproduce the problem by adding a new unit test to fennel/lucidera/test/LbmEntryTest.cpp.

To reproduce this problem through SQL, you would have to do something like the following:

create table t(a int, b int);

create index it on t(a);

insert into t values(0, 1);

-- do 134,217,736 inserts where you specify any value except 0 for column a

-- and any value for column b

insert into t values(0, 1);

analyze table t estimate statistics for columns(a);

explain plan select * from t where a = 0; -- to confirm that the index is being used to filter col a

select * from t where a = 0;

With the bug, you'll get back 2 rows, but the value of a for the second row will not be 0.