Repository navigation
Description
The range provider's string arm (fluree-db-query/src/binary_range.rs, the FlakeValue::String arm of the bound-object encoding) narrows a bound string with no datatype to xsd:string, and RangeMatch (fluree-db-core/src/query_bounds.rs) has no language. The root (binary-scan) lane reads the same constant as any string datatype or language tag, as documented, so the two lanes can answer the same query differently. #2010 fixes typed and language-tagged constants on the range lane; what's left is the untyped case, and the cost of the tagged one.
Where it shows: a JSON-LD bare-string constant served by the range lane, meaning a predicate a non-root view policy covers, or each member of a dataset spanning ledgers. There it matches xsd:string rows only. And with #2010, a language-tagged constant on that lane reads its whole predicate and checks the tag per row: 1.62 ms against 0.16 ms on the root lane at 60,000 rows (a debug build). Main answers that lookup with no rows, so this one is a cost rather than wrong rows, but it's linear in the predicate.
- "No datatype" means any string datatype, with a tight range per string
o_type. A string twin ofuntyped_numeric_slices(binary_scan.rs), sayuntyped_string_slices(store, g_id, p_id, observed, str_id), returning oneObjectSliceper stringo_typethe predicate can hold, each ato_key = str_id. Every stringo_typeshares the interned id, so each slice is a point seek:xsd:stringalways; each other string-kinded XSD datatype in the predicate's observed datatypes;lang_string(lang_id)per language whenLANG_STRINGis observed or stats are absent; and custom datatypes when stats show one. The range provider already builds one filter per slice (object_slice_filters), as it does for untyped numerics. Whetherrdf:JSONcounts as a string datatype here is a call to make; the documented rule says "string datatypes or language tags". - A language-tagged constant gets a tight range. Carry the tag (
lang: Option<Arc<str>>onRangeMatch, with awith_langbuilder) and seek(lang_string(resolve_lang_id(tag)), str_id); an unknown tag goes overlay-only. That's non-breaking for everyRangeMatch { …, ..Default::default() }literal, and the one literal that lists every field is inbinary_history.rs. (Putting it onRangeOptionsinstead avoids touchingRangeMatch, but it's a less natural home for a match criterion.) - Optional: the root lane's untyped-string path uses the same slices instead of its wild-
o_typeo_keyfilter, so both lanes share one resolution and a predicate-range read becomes k point seeks.
Edge cases: an empty slice list (the string isn't in the dictionary) goes overlay-only as today, and the novelty side already matches by value when dt is None. In a correlated join that opens a scan per driving row, we may want to cache the slice list per (operator, predicate), since only str_id changes per row.
Tests I'd want: the lane differential (root against an allow-all policy) on SPARQL and JSON-LD, a dataset of two ledgers, and a cost check for the tagged constant.
From #2010 (Not changed here: the range scan's string arm).
Activity