Skip to content

feat: return a can_assume_strict_equality for in-memory joins#5785

Merged
jacek-prisma merged 4 commits intomainfrom
fix/strict-equality-joins
Feb 27, 2026
Merged

feat: return a can_assume_strict_equality for in-memory joins#5785
jacek-prisma merged 4 commits intomainfrom
fix/strict-equality-joins

Conversation

@jacek-prisma
Copy link
Copy Markdown
Contributor

@jacek-prisma jacek-prisma commented Feb 25, 2026

TML-1868

/prisma-branch fix/strict-equality-joins

Client PR: prisma/prisma#29251

Summary by CodeRabbit

  • New Features

    • Joins now carry a flag to enable stricter equality assumptions when supported, improving cross-database join handling.
    • Validation expressions include richer context for clearer error reporting.
  • Chores

    • Connector implementations updated to advertise support for strict-equality joins where applicable, enabling optimized query generation.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0f3e1d and f18a7bc.

📒 Files selected for processing (1)
  • query-compiler/query-compiler/src/expression.rs

Walkthrough

Adds Connector::can_assume_strict_equality_in_joins with default false and overrides returning true for several built-in connectors. Carries a new boolean into Expression::Join, augments Expression::Validate with error_identifier and context, adds serde rename attributes, and threads the join flag through query translation.

Changes

Cohort / File(s) Summary
Trait Definition
psl/psl-core/src/datamodel_connector.rs
Adds fn can_assume_strict_equality_in_joins(&self) -> bool to Connector with default false.
Connector Implementations
psl/psl-core/src/builtin_connectors/cockroach_datamodel_connector.rs, psl/psl-core/src/builtin_connectors/mongodb.rs, psl/psl-core/src/builtin_connectors/mssql_datamodel_connector.rs, psl/psl-core/src/builtin_connectors/postgres_datamodel_connector.rs, psl/psl-core/src/builtin_connectors/sqlite_datamodel_connector.rs
Implement can_assume_strict_equality_in_joins returning true for Cockroach, MongoDB, MSSQL, Postgres, and SQLite connectors.
Expression System
query-compiler/query-compiler/src/expression.rs, query-compiler/query-compiler/src/expression/format.rs
Expression::Join gains can_assume_strict_equality: bool; Expression::Validate gains error_identifier: &'static str and context: serde_json::Value; #[serde(rename_all = "camelCase")] added to both variants; pattern matches updated to use .. where needed.
Query Translation
query-compiler/query-compiler/src/translate/query/read.rs
Evaluates nested queries' connectors for strict-equality support and sets can_assume_strict_equality when constructing Expression::Join.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main change: adding a can_assume_strict_equality capability for in-memory joins, which is the primary feature across all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/strict-equality-joins

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 and usage tips.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 25, 2026

Merging this PR will not alter performance

✅ 11 untouched benchmarks
⏩ 11 skipped benchmarks1


Comparing fix/strict-equality-joins (f18a7bc) with main (c6be8e6)

Open in CodSpeed

Footnotes

  1. 11 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6be8e6 and 7ba99aa.

📒 Files selected for processing (5)
  • psl/psl-core/src/builtin_connectors/mysql_datamodel_connector.rs
  • psl/psl-core/src/datamodel_connector.rs
  • query-compiler/query-compiler/src/expression.rs
  • query-compiler/query-compiler/src/expression/format.rs
  • query-compiler/query-compiler/src/translate/query/read.rs

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 25, 2026

Wasm Query Compiler File Size

Engine This PR Base branch Diff
Postgres 3.505MiB 3.505MiB 162.000B
Postgres (gzip) 1.142MiB 1.142MiB 22.000B
Postgres (size-optimized) 1.766MiB 1.766MiB 159.000B
Postgres (size-optimized, gzip) 694.997KiB 694.771KiB 231.000B
Mysql 3.458MiB 3.457MiB 170.000B
Mysql (gzip) 1.127MiB 1.127MiB 53.000B
Mysql (size-optimized) 1.736MiB 1.736MiB 159.000B
Mysql (size-optimized, gzip) 684.226KiB 683.919KiB 314.000B
Sqlite 3.376MiB 3.376MiB 162.000B
Sqlite (gzip) 1.098MiB 1.099MiB -125.000B
Sqlite (size-optimized) 1.692MiB 1.692MiB 151.000B
Sqlite (size-optimized, gzip) 667.290KiB 667.310KiB -21.000B
SQL Server 3.598MiB 3.598MiB 170.000B
SQL Server (gzip) 1.162MiB 1.162MiB 192.000B
SQL Server (size-optimized) 1.766MiB 1.766MiB 151.000B
SQL Server (size-optimized, gzip) 698.656KiB 698.218KiB 448.000B
CockroachDB 3.555MiB 3.555MiB 174.000B
CockroachDB (gzip) 1.160MiB 1.160MiB 36.000B
CockroachDB (size-optimized) 1.791MiB 1.791MiB 155.000B
CockroachDB (size-optimized, gzip) 705.226KiB 704.995KiB 237.000B

@jacek-prisma jacek-prisma merged commit 94a226b into main Feb 27, 2026
98 of 99 checks passed
@jacek-prisma jacek-prisma deleted the fix/strict-equality-joins branch February 27, 2026 08:20
jacek-prisma added a commit to prisma/prisma that referenced this pull request Feb 27, 2026
[TML-1868](https://linear.app/prisma-company/issue/TML-1868/fix-mysql-bigint-relation-issue)

Adds support for a new `canAssumeStrictEquality` flag used for in-memory
joins. When it's set to false, we infer the type of the key present on
the parent rows and inject casts for children rows. Fixes some MySQL
edge cases.

Fixes #29122

Engine PR: prisma/prisma-engines#5785

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Improved join key matching with optional per-field value mapping/type
casting and a new flag to control strict-equality assumptions.
* Standardized validation error identifiers to camelCase for more
consistent error reporting.

* **Tests**
* Added MySQL-only functional tests for view relations with large BigInt
keys.

* **Chores**
  * Updated internal engine/tooling version references.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Prismo <prismabots@gmail.com>
jacek-prisma added a commit to prisma/prisma that referenced this pull request Feb 27, 2026
[TML-1868](https://linear.app/prisma-company/issue/TML-1868/fix-mysql-bigint-relation-issue)

Adds support for a new `canAssumeStrictEquality` flag used for in-memory
joins. When it's set to false, we infer the type of the key present on
the parent rows and inject casts for children rows. Fixes some MySQL
edge cases.

Fixes #29122

Engine PR: prisma/prisma-engines#5785

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Improved join key matching with optional per-field value mapping/type
casting and a new flag to control strict-equality assumptions.
* Standardized validation error identifiers to camelCase for more
consistent error reporting.

* **Tests**
* Added MySQL-only functional tests for view relations with large BigInt
keys.

* **Chores**
  * Updated internal engine/tooling version references.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Prismo <prismabots@gmail.com>
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