feat: support compound join conditions with and() (issue #593)#861
Open
lousydropout wants to merge 2 commits intoTanStack:mainfrom
Open
feat: support compound join conditions with and() (issue #593)#861lousydropout wants to merge 2 commits intoTanStack:mainfrom
lousydropout wants to merge 2 commits intoTanStack:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 82d50c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Allow joining on multiple fields simultaneously using and() to combine
multiple eq() expressions in join conditions.
Example:
.join(
{ inventory: inventoriesCollection },
({ product, inventory }) =>
and(
eq(product.region, inventory.region),
eq(product.sku, inventory.sku)
)
)
- Add extractJoinConditions() helper to parse and() expressions
- Extend JoinClause IR with additionalConditions field
- Implement composite key extraction with JSON.stringify
- Preserve fast path for single conditions (no serialization)
- Disable lazy loading for compound joins
Fixes TanStack#593
f74ded2 to
9a9e362
Compare
Enhance the original compound join test to verify actual row contents and add 4 additional test cases covering edge cases: - Partial field matches (ensures AND semantics) - LEFT join behavior with unmatched rows - Null value handling in compound conditions - Joining on 3+ fields simultaneously These tests validate the compound join implementation across different join types (INNER, LEFT) and ensure correct behavior with complex data scenarios.
Collaborator
|
Hey @lousydropout thanks for this, on quick skim it looks close to what I was thinking (composite key for I'm on bug fixes at the moment after we released the incremental sync stuff, and so it will be a few days before I get a chance to look in detail. |
|
Kind of fundamental feature, will it be released soon? |
|
What needs to be done for this to be merged? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow joining on multiple fields simultaneously using and() to combine multiple eq() expressions in join conditions.
Example:
.join(
{ inventory: inventoriesCollection },
({ product, inventory }) =>
and(
eq(product.region, inventory.region),
eq(product.sku, inventory.sku)
)
)
Fixes #593
🎯 Changes
✅ Checklist
pnpm test:pr.🚀 Release Impact