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
Integer literals from VALUES/expressions compare as xsd:long while stored integers are xsd:integer — same number is two distinct terms #1319
A plain integer literal in a query (VALUES ?n { 5 }) lowers to a binding with datatype xsd:long, while the same integer stored in a ledger materializes from the index as xsd:integer. Since term equality includes the datatype, the same number arriving from the two sources is treated as two distinct RDF terms.
Per SPARQL, the bare literal 5 is "5"^^xsd:integer, so this should dedup to one row. The same mismatch makes joins/MINUS/GROUP BY on integer values miss across the two sources.
Notes
Independent of binding representation (encoded vs decoded) — it reproduces decoded-vs-decoded, e.g. against novelty-only data. Discovered while building fluree-db-api/tests/it_mixed_representation.rs (see the NOTE comment there excluding the integer case).
Value-space comparison paths (FILTER =, numeric operators) are unaffected; this is about term identity surfaces: DISTINCT, GROUP BY keys, COUNT(DISTINCT), join unification, MINUS.
Needs a canonicalization decision rather than a point fix: either lower bare integer literals to xsd:integer end-to-end, or canonicalize the int64 datatype family at the term-identity surfaces.
Status on current main: the triple-pattern constant path now tags bare integers xsd:integer (fluree-db-sparql/src/lower/term.rs, added in ce5d0a8db), but the VALUES path still lowers bare Integer to xsd:long, and the query side keeps the datatype id in term/group keys (object_binding.rs, group_aggregate.rs), so the DISTINCT-returns-two-rows repro still reproduces. datatypes_equivalent / is_integer_family exist in fluree-db-query/src/context.rs but currently have no callers — no canonicalization is wired in yet. Keeping this open as the tracker (supersedes #1343).
Verified mechanism from the W3C burn-down audit (PR #1437, docs/audit/burn-down/expression-semantics.md + ROADMAP §1.1-7): ordinary pattern objects carry no datatype constraint at all (lower/term.rs:164-166, deliberate), and dt_compatible is asymmetric and not consulted on that path — so the join itself survives today, and the impact is the output datatype tag and term identity (DISTINCT/GROUP BY/sameTerm). The correct fix is at lowering (bare integers in VALUES/expressions → xsd:integer, roadmap PR-X1), not extending dt_compatible. Scan-path datatype constraints are a separate, perf-sensitive item (D5b) tracked with its own bench gate.
Activity
aaj3f commentedon Jun 29, 2026
See also #1343 (that issue closed as a duplicate of this one)
aaj3f commentedon Jun 29, 2026
Status on current
main: the triple-pattern constant path now tags bare integersxsd:integer(fluree-db-sparql/src/lower/term.rs, added ince5d0a8db), but the VALUES path still lowers bareIntegertoxsd:long, and the query side keeps the datatype id in term/group keys (object_binding.rs,group_aggregate.rs), so the DISTINCT-returns-two-rows repro still reproduces.datatypes_equivalent/is_integer_familyexist influree-db-query/src/context.rsbut currently have no callers — no canonicalization is wired in yet. Keeping this open as the tracker (supersedes #1343).aaj3f commentedon Jul 6, 2026
Verified mechanism from the W3C burn-down audit (PR #1437,
docs/audit/burn-down/expression-semantics.md+ ROADMAP §1.1-7): ordinary pattern objects carry no datatype constraint at all (lower/term.rs:164-166, deliberate), anddt_compatibleis asymmetric and not consulted on that path — so the join itself survives today, and the impact is the output datatype tag and term identity (DISTINCT/GROUP BY/sameTerm). The correct fix is at lowering (bare integers in VALUES/expressions →xsd:integer, roadmap PR-X1), not extendingdt_compatible. Scan-path datatype constraints are a separate, perf-sensitive item (D5b) tracked with its own bench gate.fix(query): lower bare integers to xsd:integer in VALUES/inline data