Skip to content

feat(query): set-membership predicates (#316, PR 2 of 3) - #743

Merged
adityamukho merged 3 commits into
v3from
feat/316-set-predicates
Oct 24, 2026
Merged

adityamukho merged 3 commits into
v3from
feat/316-set-predicates

Conversation

@adityamukho

Copy link
Copy Markdown
Collaborator

Part of #316, PR 2 of 3 (set-membership predicates; spec §6, plan steps 13–16).

What

  • BinOp::{In, NotIn, AnyIn, AllIn, NoneIn}: in? / not-in? (scalar, set), any-in? / all-in? / none-in? (set, set). They work as filters and as Boolean bindings.
  • Membership uses Value's Ord (spec §2), so NaN, -0.0/0.0 and keyword ≠ ref need no special case.
  • A wrong operand shape is a type mismatch (Err(())): a filter drops the row and a binding binds nothing. So not-in? with a non-set is never true.
  • Empty sets follow the spec table: in? x #{} is false, not-in? x #{} true; with an empty first set, all-in?/none-in? are true and any-in? is false.
  • Arity is PRS-065, as for contains?. The five names are built-in predicate sentinels, so register_predicate refuses them. contains? stays string-only.
  • Grammar: the five names are added to binary_op, docs/GRAMMAR.md is regenerated, and there is a corpus fixture query_expr_set_predicates.edn.
  • Prepared sets needed no code (PR 1's substitution already carries Value::Set). They are tested in an operand slot and a value slot, each re-executed with different sets.

Gaps from the plan

  • #uuid is not an expression argument, in the parser or the grammar; that was already true. Ref operands are tested through stored attributes and bind slots instead.
  • The verifier TOKENS are unchanged: the string predicates are not tokens either, so the verifier's cost stays the same.
  • The :order-by over a set column test waits for No working result-limiting/pagination mechanism for plain (non-recursive) :find queries #306's implementation, which has not merged. Whichever of the two lands second adds it.

Tests

  • tests/set_predicates_test.rs (12 tests).
  • Prepared set binds (2 tests).
  • An eval_binop unit test.
  • Counts: 1,775 default (1,762 passing, 13 ignored), 1,794 with test-hooks.
  • cargo test --all-features ran on an idle machine: 1,780 passed, 0 failed.
  • cargo clippy --all-features (native) and both wasm targets are clean.
  • Codex review: no findings.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TcpoiFyFeQQQELL872LfQF

adityamukho and others added 3 commits October 24, 2026 16:18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TcpoiFyFeQQQELL872LfQF
…, none-in? (#316)

Five BinOps over set values: filters and Boolean bindings, membership by
Value's Ord (one NaN, -0.0 = 0.0, keyword != ref). A wrong operand shape is
a type mismatch, so not-in? with a non-set drops the row. The names are
built-in predicate sentinels. Grammar, GRAMMAR.md and a corpus fixture;
prepared set binds tested in operand and value slots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TcpoiFyFeQQQELL872LfQF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TcpoiFyFeQQQELL872LfQF
@codecov

codecov Bot commented Oct 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@adityamukho
adityamukho merged commit 8f2d51f into v3 Oct 24, 2026
19 checks passed
@adityamukho
adityamukho deleted the feat/316-set-predicates branch October 24, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant