Repository navigation
Description
A triples map over an Iceberg table can now narrow its rows with a restricted rr:sqlQuery
(SELECT * FROM t WHERE <col> <op> <literal> [AND ...]), applied exactly on every read. Two
things this change leaves out:
1. Tracked materialization of a filtered map
/iceberg/materialize and /iceberg/track refuse a mapping with an rr:sqlQuery logical table.
They retract a subject only when a row they read says to (a tombstone, or a change-feed delete).
A row that stops matching the map's WHERE (is_current going from 1 to 0) is filtered out of
every later read, incremental or full, so the subject it produced is never retracted, and the
target keeps a subject the source no longer maps. Today the remedy is a full rebuild with
fluree materialize.
A sound tracked path could read the window unfiltered and treat each row that fails the map's
filter as a tombstone for the subject it would have produced, in latest-by-key mode:
- Read the incremental window without the mapping filter, with the filter columns projected.
- Evaluate the filter per row (the same
ExactRowFilterrules), keeping the outcome. - For each subject key, take the latest row by
order_by. If it passes the filter, upsert the
subject. If it fails, retract the subject. - This needs a declared subject key (the planned
f:keyon the logical table) and anorder_by,
so it fits latest-by-key mode only. The additive mode has no notion of "the latest row for a
subject", so it would keep refusing. - Open: a subject produced by two filtered maps over different tables, and a filter that never
matched a key (nothing to retract, which is correct).
2. Comparisons on date, timestamp, time, binary and uuid columns
A row filter compares integer, decimal, floating-point, string and boolean columns, and tests any
column only with IS [NOT] NULL. Comparing other types is refused, with an error naming the
column and its type. Accepting them needs a literal form for each (e.g. DATE '2024-01-01',
TIMESTAMP '...', or a quoted string read as the column's type), with exact rules:
date: days since the epoch, so it compares exactly.timestamp/timestamptz: microseconds. Decide how a zone offset in the literal applies to
atimestamp(no zone) column.time: microseconds since midnight.binary/fixed: a hex literal (X'00ff'), compared bytewise.uuid: its canonical text.
The reader already compares these column types for query FILTER pushdown, so the work is mostly
the literal syntax and the typing rules.
Activity