Skip to content

Collapse fetch_filtered's paired kwargs into plan-driven dispatch #301

Description

@0x054

Follow-up to #300 (the QueryIR wire choke point).

fetch_filtered (src/operations.rs:2418-2824, ~400 lines) exposes the materialization plan's internal shape as two optional kwargs the caller must pair correctly:

  • record_cls — required iff the plan is record
  • hop_classes — required for instances plans and traversed-projection record plans

Four PyValueError guard arms exist only to catch caller mis-pairing, and Python re-walks the relation-spec chain (_hop_classes_for_paths, duplicating resolve_join_hops) to ship a to_table → model class map that Rust could resolve itself from MODEL_REGISTRY (table→model is unambiguous, enforced at registration — see query.rs:322).

Proposal: dispatch on plan.materialization inside Rust. The payload already names the mode; Rust resolves the record class and hop classes from the registry keyed off the plan. The FFI shrinks to (cls, query_ir_json, route), the four pairing errors become unrepresentable states, and the Python-side spec-chain re-walk disappears.

Now safe to do against a pinned contract: the golden vectors assert the builder→serde bytes from both sides, so this is a pure Rust-side dispatch change with no wire impact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions