Skip to content

Route zipped relations through the foreach extension point - #396

Merged
yoohaemin merged 4 commits into
masterfrom
refactor/typed-interpreter-zip
Nov 2, 2026
Merged

yoohaemin merged 4 commits into
masterfrom
refactor/typed-interpreter-zip

Conversation

@yoohaemin

@yoohaemin yoohaemin commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Zipped relations now combine their two branches through one internal zipWith helper that delegates to foreach. foreach remains the only overridable operation for combining independent effects, so bulk traversal and zipped relations cannot select conflicting batching implementations.

Both interpreter models use the helper for single and bulk zips. It is package-private and final; its internal casts rely on foreach preserving result count and positional correspondence. The default foreach sequences directly with flatMap and map, avoiding recursion through the helper. Fetch and ZQuery keep their existing foreach implementations; no separate zip override is required.

The Fetch regression exercises actual zipped relations backed by a shared datasource and checks that independent keys share one batch. The asynchronous assertion is returned to the Scala.js test runner.

Parent of #400. Review and merge this PR first; #400 builds Kyo query plans through the same foreach extension point.

Validation: core, ZQuery, and Fetch suites on Scala 2.13 and 3.3.9, plus Fetch Scala.js tests. Changed Scala sources formatted.

Copilot AI balanced review requested due to automatic review settings October 17, 2026 04:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The shared Fetch regression uses JVM-only unsafeRunSync, breaking Scala.js test compilation.

1 open issue
What changed in this PR

Replaces erased zip traversal with a typed interpreter primitive, preserving specialized batching behavior.

Changes:

  • Uses typed zipWith for single and bulk relations in both interpreter models.
  • Adds batching overrides for ZQuery and Fetch.
  • Adds a Fetch batching regression and test dependencies.
File Description
zquery/​src/​main/​scala/​decrel/​reify/​zquery.scala Uses batched zip composition.
fetch/​src/​test/​scala/​decrel/​reify/​FetchZipSpec.scala Adds a shared-datasource batching regression.
fetch/​src/​main/​scala/​decrel/​reify/​fetch.scala Implements zip using applicative mapN.
core/​src/​main/​scala/​decrel/​reify/​monofunctor/​reifiedRelation.scala Replaces erased traversal with typed zip.
core/​src/​main/​scala/​decrel/​reify/​monofunctor/​access.scala Exposes the protected zip primitive.
core/​src/​main/​scala/​decrel/​reify/​bifunctor/​reifiedRelation.scala Replaces erased traversal with typed zip.
core/​src/​main/​scala/​decrel/​reify/​bifunctor/​access.scala Exposes the protected zip primitive.
build.sbt Adds Fetch test dependencies.

Review effort: Balanced

@yoohaemin
yoohaemin force-pushed the refactor/typed-interpreter-zip branch from afadfe5 to 953aadd Compare November 2, 2026 13:00
@yoohaemin yoohaemin changed the title Replace erased zip traversal with a typed interpreter primitive Route zipped relations through the foreach extension point Nov 2, 2026
@yoohaemin
yoohaemin merged commit 80e15c9 into master Nov 2, 2026
9 checks passed
@yoohaemin
yoohaemin deleted the refactor/typed-interpreter-zip branch November 2, 2026 13:48
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