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
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
Found this while working out how R2RML columns without an rr:datatype behave, and it turned out several query lanes don't agree with each other about it.
An rr:column with no rr:datatype is an xsd:string literal of the cell's rendering today (10, -0, 0.050000000, 2024-01-01T00:00:00Z), so the generic pipeline groups, orders and compares it as that string. Several lanes read the physical column instead and answer differently. A few of them are scan pushdowns that run with FLUREE_DISABLE_QUERY_FAST_PATHS too, so the fast-vs-generic differential can't see them (the #1700 pattern). Claude traced each lane and reproduced every case against main. With a table holding 2, 9, -3, 9 in one data file and 10, 100, 10 in another:
Fused aggregate (Iceberg).SELECT ?v (COUNT(?s) AS ?n) WHERE { ?s ex:col ?v } GROUP BY ?v over an un-annotated column returns no rows for any non-string physical type: the key reader found no string and dropped every row.
SQL lanes.
MAX(?v) returns 100 where the generic answer is "9".
ORDER BY ?v LIMIT 2 and the grouped top-k return the numerically smallest or largest rows.
GROUP BY, COUNT(DISTINCT) and SELECT DISTINCT over a double merge -0.0 with 0.0.
Joins on a value pair -0.0 with 0.0, 10 with 10.00, and 0.05 with 0.050000000.
Iceberg scan pushdowns, in both lanes.
ORDER BY DESC(?v) LIMIT 1 returns "100" where the answer is "9": the scan-side top-k skipped the file holding the 9s by its numeric bounds.
xsd:integer declared over a string column holding those values as text returns 9 where the answer is 100.
FILTER(?v < "5") and FILTER(?v > "50") lose rows, because the reader casts the string literal to an integer and filters by value.
The mechanism, in short:
the SQL lowering classed a column by its rr:datatype alone, so it trusted Str to mean text;
the fused key reader only read a string key from a string column;
the scan's top-k and comparison pushdowns ordered and compared the physical value, whatever the term's datatype.
The generated mappings annotate every non-string column, so in practice this bites hand-written mappings. What seems right to me: every lane answers exactly what the generic pipeline answers under today's semantics. The semantics question itself (R2RML's natural datatype for un-annotated columns) is a separate, bigger change I'll file next to this one.
Activity