Skip to content

Port tuple-output functions from egglog#938#3

Closed
oflatt-claude wants to merge 4 commits into
saulshanabrook:mainfrom
oflatt-claude:port-tuple-outputs
Closed

Port tuple-output functions from egglog#938#3
oflatt-claude wants to merge 4 commits into
saulshanabrook:mainfrom
oflatt-claude:port-tuple-outputs

Conversation

@oflatt-claude

Copy link
Copy Markdown

Ports egraphs-good/egglog#938 ("Add tuple-output functions") into the vendored egglog/ subtree of this repo.

What it adds

Tuple-output functions — a function may declare more than one output sort:

(function interval (Math) (i64 i64)
  :merge (values (max old0 new0) (min old1 new1)))   ; col 0 = lo, col 1 = hi

Outputs are stored as separate value columns (no boxing); the functional dependency maps keys to a tuple of values. They are:

  • destructured in queries: (= (values lo hi) (interval x))
  • written in actions: (set (interval x) (values 0 100))
  • merged with a (values e0 e1 …) clause where ei merges column i, referencing the bound variables old0, new0, old1, new1, …

This collapses analyses that previously needed one function per output into a single function.

Tuple outputs are restricted to plain functions (not constructors/relations/view tables) and are not supported by the term/proof encoding (reported cleanly via ProofEncodingUnsupportedReason::TupleOutputFunction).

Porting notes

  • The upstream diff (gh pr diff 938) applies onto the vendored egglog/ subtree with a single conflict in src/proofs/proof_encoding_helpers.rs: this fork carries an extra NaiveEqSortPrimitiveFact reason/check that shifted the surrounding context, so the new TupleOutputFunction enum variant and the tuple-output guard in command_supports_proof_encoding were reapplied by hand. All other 19 files applied cleanly.
  • Verified locally: cargo build --release --tests, cargo test --release --test tuple_outputs (11/11), and the full cargo test --release suite.

Draft — first step of porting egglog changes into this fork.

🤖 Generated with Claude Code

oflatt and others added 2 commits July 7, 2026 20:27
Ports egraphs-good/egglog#938 ("Add tuple-output functions") into the
vendored egglog/ subtree. A function may declare more than one output
sort, stored as separate value columns (no boxing); outputs are
destructured in queries, written in actions, and merged per column with
a (values ...) clause. Restricted to plain functions and unsupported by
the term/proof encoding.

The upstream diff applied cleanly except for one context conflict in
src/proofs/proof_encoding_helpers.rs (this fork carries an extra
NaiveEqSortPrimitiveFact reason); the TupleOutputFunction variant and
guard were reapplied by hand.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The workspace root now builds egglog-experimental alongside egglog, so it must
handle the tuple-output additions from the #938 port: add `extra_outputs: vec![]`
to the fresh! constructor Schema, and a `ResolvedCall::Values(_) => Context::Pure`
arm (tuple construct/destructure reads/writes no tables).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 688a221f-9698-49ab-b25e-93686f0b1dbd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

oflatt and others added 2 commits July 7, 2026 21:14
Fix a doubled word and grammar in the `function` command doc, drop the
redundant sentence on `Schema::extra_outputs` (already covered by
`Schema::outputs`), and trim the memory-representation aside from the
CHANGELOG entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`input_file` built rows and validated types using only `schema.output`,
so loading a tuple-output custom function from a TSV rejected valid rows
(too many fields) and would have inserted too few columns. Use
`schema.outputs()` for both the type check and the row schema. Adds a
regression test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codspeed-hq

codspeed-hq Bot commented Jul 8, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 3 untouched benchmarks


Comparing oflatt-claude:port-tuple-outputs (e688d4c) with main (d9b4001)

Open in CodSpeed

@oflatt

oflatt commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

closing , out of date

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