Skip to content

quack: SQL WHERE against PostgreSQL through sql_where + mask-risc, compared by mask Xor - #1677

Merged
AdaWorldAPI merged 6 commits into
mainfrom
ccr-0455e606-wmtsor
Oct 21, 2026
Merged

AdaWorldAPI merged 6 commits into
mainfrom
ccr-0455e606-wmtsor

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Adds a PostgreSQL differential on the existing architecture. It replaces nothing: the contract-side oracles and k3_pg_parity are back to their state on main.

Change

crates/lance-graph-quack/examples/k3_where_pg_parity.rs:

  • Random contract SetExprs are mapped to Quack Filters. The mapping only; every operator is one Quack already has.
  • Each filter is executed by the engine: Filter::sql_where (TRUE/FALSE lowering over each column's validity plane; a NULL is valid = 0, distinct from a valid 0), then lower and lower_fused, then mask-risc execute_into with the Keep terminal.
  • PostgreSQL is the independent semantic reference. For each expression it returns the rows where the predicate is TRUE and the rows where it is FALSE.
  • Equality is checked on the masks, never on counts: mask-risc Xor, then the Any terminal. Both TRUE and FALSE masks are compared, so an UNKNOWN row cannot hide.
  • normalize_kleene is held to its own contract, which is WHERE-terminal: TRUE rows exact, and the number of expressions where it moves FALSE rows is reported.

No new evaluator, counting loop, equality helper or terminal.

Board: the eval and co-research entries record the decision that oracles do not compare tuples, and point to this example.

Verification

PostgreSQL 16.14, 2000 expressions over 200 rows, 55,916 UNKNOWN row verdicts:

  • As written: Quack's TRUE and FALSE masks equal PostgreSQL's on 2000/2000, in both lower and lower_fused.
  • normalize_kleene (1537 rewritten): TRUE masks equal on 2000/2000. It moves FALSE rows on 337, which is its WHERE-terminal contract.
  • Two-valued normalize: TRUE mask differs on 499.

Disable runs, each red:

  1. Lower without sql_where: FALSE rows differ.
  2. The mapping drops NOT: FALSE rows differ.
  3. differ never fires: the two-valued anti-vacuity assertion fails.

cargo +1.99.0 clippy --release -p lance-graph-quack --example k3_where_pg_parity -- -D warnings: clean. fmt clean. Without a server the example prints SKIP and exits 0.

Not changed

join_probe.rs, walk_mask.rs:361-372 and gremlin_parity.rs keep their row-shaped oracles.

🤖 Generated with Claude Code

https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg

… popcount

The reference evaluator held the table as Vec<Row> and evaluated each
row separately. It now holds column lanes with validity planes and
evaluates whole (T, F) bit planes; the count is a popcount over the T
plane. Rendering the INSERT still reads lanes side by side, because that
is the input given to PostgreSQL, not a comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
Both reference evaluators recursed per row (Option<bool> at one row).
They now evaluate whole TRUE/FALSE masks over the column lanes; the
set_rules measures fold the TRUE mask against the multiplicity and value
lanes in slot order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
…cle role

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

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 445d33de-e84f-4a4e-a248-14cadf81c814
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…c against PostgreSQL

Restores the contract-side oracles and k3_pg_parity to main (no
existing code replaced). Adds a Quack example that executes each
expression through the engine that already exists: Filter::sql_where,
lower and lower_fused, mask-risc execute_into with the Keep terminal.
PostgreSQL returns the TRUE and the FALSE rows per expression; equality
is mask-risc Xor followed by the Any terminal, on both masks.

normalize_kleene is held to its WHERE-terminal contract: TRUE rows
exact, FALSE-row movement reported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G22yT6htkcdyXsihxxXdrg
@AdaWorldAPI AdaWorldAPI changed the title Kleene oracles fold over (T, F) masks; no tuple comparison in oracles quack: SQL WHERE against PostgreSQL through sql_where + mask-risc, compared by mask Xor Oct 21, 2026
@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review October 21, 2026 20:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T20:09:44.581734Z ffd7e61 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

2 participants