Skip to content

Define intersection result extraction before the first update #192

Description

@tisonkun

ThetaIntersection::to_sketch and TupleIntersection::to_sketch currently panic when called before the first update. Both operators expose has_result, and tests explicitly cover the panic, but absence of an intersection state is part of the public state machine and deserves a deliberate API contract.

We should decide whether result extraction should:

  • return Option when no result is a normal state;
  • return Result when calling before update is considered recoverable misuse; or
  • retain the panic, with a clear invariant and local Panics documentation.

Points to settle:

  • Apply the same contract to Theta and Tuple intersections.
  • Decide whether has_result remains useful after result extraction becomes typed.
  • Define the mathematical meaning of zero updates; the identity for intersection cannot be represented as a finite sketch.
  • Consider reset if it is added to the operators later.
  • Check Java and C++ precedent, while keeping the Rust API misuse-resistant.
  • Document migration if the return type changes before 1.0.

This issue intentionally records the design question rather than prescribing Option or Result immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions