You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make NULL handling semantics consistent when enabling or disabling indexes #4814
The python/tests/test_scalar_index.py::test_null_handling test reveals inconsistent NULL handling semantics when indexing is enabled or disabled. This inconsistency may lead to unstable query results.
deftest_null_handling(tmp_path: Path):
tbl=pa.table(
{
"x": [1, 2, None, 3],
}
)
dataset=lance.write_dataset(tbl, tmp_path/"dataset")
defcheck(has_index: bool):
assertdataset.to_table(filter="x IS NULL").num_rows==1assertdataset.to_table(filter="x IS NOT NULL").num_rows==3assertdataset.to_table(filter="x > 0").num_rows==3assertdataset.to_table(filter="x < 5").num_rows==3assertdataset.to_table(filter="x IN (1, 2)").num_rows==2# Note: there is a bit of discrepancy here. Datafusion does not consider# NULL==NULL when doing an IN operation due to classic SQL shenanigans.# We should decide at some point which behavior we want and make this# consistent.ifhas_index:
assertdataset.to_table(filter="x IN (1, 2, NULL)").num_rows==3else:
assertdataset.to_table(filter="x IN (1, 2, NULL)").num_rows==2check(False)
dataset.create_scalar_index("x", index_type="BITMAP")
check(True)
dataset.create_scalar_index("x", index_type="BTREE")
check(True)
I’m not fully familiar with this code area. Could someone share context on potential trade-offs or design decisions here? All perspectives are welcome!
Activity