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
Range semijoin prunes POST leaflets by o_key without checking the key's o_type #2399
The range semijoin skips a POST leaflet when last < lo || first > hi (fluree-db-query/src/range_semijoin.rs:693-700). It reads o_key from the leaflet's first_key/last_key without checking that those keys' o_type is the leaflet's o_type_const.
POST segments by predicate only. So on the same predicate, a retracted value of another type can widen last_key into that type (see #2394 for the widening). For example, a string on an integer predicate does this, because XSD_STRING (0x8000) sorts after the integer types. last.o_key is then a string id compared against integer bounds, and a leaflet that holds matching rows can be skipped.
post_o_key_bounds in fluree-db-query/src/join.rs:3586 does the same prune correctly. It compares (p_id, o_type) before using o_key, and treats a key of another type as an open bound.
Found by reading main at f42ea37. Not reproduced, and I haven't confirmed which query shapes reach this operator (the BSBM-Q5-style range fold).
Repro to try
Give ex:n 20 integer values and one string.
Delete the string.
Run a full build.
Run a ?p ex:n ?sim FILTER(?sim > ?orig - 3 && ?sim < ?orig + 3) shape, and compare it against fluree_db_api::set_fast_paths_disabled(true) on the same view.
Fix
Use post_o_key_bounds here instead of the raw o_key comparison. This needs no format change.
Related, performance only: the numeric-compare lane's first.o_type != raw_otype check (fluree-db-query/src/fast_count.rs:544) permanently declines for any predicate that has ever had a retracted value of another type.
Fixed on next by #2402 (merged 2026-11-19, c63b329): the range semijoin prunes with post_o_key_bounds, as the batched join already did. Covered in it_leaflet_live_edges.
The fix needs no format change, so it can go to main as is. Open until it does.
Activity
bplatz commentedon Nov 20, 2026
Fixed on
nextby #2402 (merged 2026-11-19, c63b329): the range semijoin prunes withpost_o_key_bounds, as the batched join already did. Covered init_leaflet_live_edges.The fix needs no format change, so it can go to
mainas is. Open until it does.