Repository navigation
Open
Labels
P2Scheduled: real but not urgentarea:queryQuery execution, planning, fast paths, overlay, result formattingenhancementNew feature or request
Description
R2RML §10.2 says an rr:column with no rr:datatype gets the natural RDF literal of the column's SQL type (integers → xsd:integer, decimals → xsd:decimal, doubles → xsd:double, booleans, dates, timestamps, binary → xsd:hexBinary). We read every such column as xsd:string of its rendering instead. docs/graph-sources/sql.md says so; docs/graph-sources/iceberg.md's type table claims otherwise. The practical effect is that a hand-written mapping over numeric columns silently gets string semantics: FILTER(?v > 80) returns nothing, ORDER BY and MIN/MAX are lexical, SUM is unbound, and values don't join with native typed data.
The design we've settled on:
- One effective datatype per object map.
rr:datatypewhen present, else the column's natural type, through the generator's existingxsd_datatype(fluree-db-r2rml/src/emit/naming.rs), which is already R2RML's natural table. The one deliberate deviation isFloat32→xsd:float, which is exact for an f32. It's extended for Icebergtime→xsd:timeanduuid→xsd:string. Every site that decides a column term's typing reads it: the materializer, the literal encoder, the materialize sinks, ledger-info, pushdown coercion, the fused-aggregate and SQL-lane gates, and preview. So a hand-written and a generated mapping behave identically, and no lane can disagree with another (the bug class behind R2RML: lanes group, order and compare an un-annotated column by its physical value instead of its term (empty GROUP BY, wrong MIN/MAX, ORDER BY … LIMIT and FILTER results) #2191). - Lane coverage includes ANNOTATED columns whose declared type disagrees with the physical type: an
xsd:integer-annotated text column read by the fused integer key, a numeric class over a varchar in the SQL lane, anrr:termType rr:IRImap over a non-text column. These are the cases R2RML: lanes group, order and compare an un-annotated column by its physical value instead of its term (empty GROUP BY, wrong MIN/MAX, ORDER BY … LIMIT and FILTER results) #2191 leaves open. - Constant matching becomes native-consistent: value equality within a type family (
1matches1.0), never across families ("1"doesn't match1), which is what native ledgers already do. Today the R2RML operator's residual match is lexical and crosses families, so a virtual source and its materialized target answer the same query differently. - Lexical forms: only the invalid ones are fixed (a naive timestamp gets no
Z;timerenders asHH:MM:SS[.ffffff], not micros; uuids are dashed). Template and join-key rendering stays byte-identical, so no subject IRI changes. - Materialized targets: a change in a source's effective typing forces one full refresh (a typing version folded into the mapping hash that's recorded today but never compared), so a target never holds mixed string and typed facts.
- No compatibility flag.
rr:datatype xsd:stringon a column is R2RML's own per-column opt-out, and the release note will say so. - Docs: fix the
iceberg.mdandsql.mdtype tables and the un-annotated numeric examples inr2rml.md/sql.md.
This changes query results for hand-written mappings, so it'll ship as breaking-change.
Metadata
Metadata
Assignees
Labels
P2Scheduled: real but not urgentarea:queryQuery execution, planning, fast paths, overlay, result formattingenhancementNew feature or request
Activity