Skip to content

Iceberg graph sources: push keys for an object variable the scan's input binds (and a seeded sub-select's key) #2310

Open

Description

@aaj3f

Problem

#2239 pushes a scan's subject keys when its input binds the subject variable. When the input binds an object variable instead, nothing is pushed:

SELECT ?o ?a WHERE {
  VALUES ?c { <http://example.org/customer/1> <http://example.org/customer/2> }
  ?o ex:customer ?c ; ex:amount ?a
} ORDER BY DESC(?a) LIMIT 3

Here ex:customer is a referencing object map. The scan of the order table reads every row and joins ?c in memory. The same holds for a scalar object (?o ex:status ?s with ?s from an earlier pattern), unless it comes from a single-var VALUES of literals.

Since the scan-side top-k is no longer offered to a scan whose input binds one of its variables (that pushdown was unsound: the join dropped rows the heap had seen), shapes like ?c ex:name ?n . ?o ex:customer ?c ; ex:amount ?a ORDER BY DESC(?a) LIMIT 10 now read the whole fact table.

Expected

  • For a bound object variable whose predicate maps to a referencing object map, reverse each bound IRI through the parent map's subject template. Where the parent template's columns are the join's parent columns, the reversed values are the child's join key: push them as an IN on the child join column(s).
  • For a plain rr:column object, push the bound literals as an IN, under the same per-member coercion rules FILTER … IN uses.
  • Same window, cap, and perf-guard rules as the subject push.

Where

  • fluree-db-query/src/r2rml/operator.rs: child_subject_iris, SubjectKeys::of (subject only today).
  • fluree-db-r2rml TemplateReverser.

Follow-up from #2239.

Same mechanism: a sub-select seeded per outer row

A JSON-LD sub-select correlated with an outer pattern is re-run per outer row with that row as its seed (#2241). The
seed binds the sub-select's join variable, typically a foreign-key object (?o ex:customer ?c with ?c from the
outer row), so each per-row read scans the whole child table. Pushing the seed's bound object as an IN on the
child's join column (the same reversal as above) would let each per-row read prune files.

Follow-up from #2241.

Activity

  1. added
    P2
    area:iceberg
    performance
    on Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:icebergperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions