Skip to content

Fix multiple relationships pointing to the same collection#88

Merged
codedmart merged 5 commits into
mainfrom
djh/fix-multiple-relationships-to-the-same-collection
Oct 5, 2025
Merged

Fix multiple relationships pointing to the same collection#88
codedmart merged 5 commits into
mainfrom
djh/fix-multiple-relationships-to-the-same-collection

Conversation

@danieljharvey

@danieljharvey danieljharvey commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

Fixed for both Snowflake and Trino. Augment wrote this, I have not run it, but this is the fix I would expect here.

@GavinRay97

GavinRay97 commented Sep 29, 2025

Copy link
Copy Markdown
Member

This looks semantically correct to me, it's clear that we shouldn't have been dropping the alias from the Query IR when mapping there I'm fairly sure -- thank you!

Will need to figure out why Snowflake variables nested test is complaining

@GavinRay97

Copy link
Copy Markdown
Member

Note: Update our tests so every test has deterministic ordering

@codedmart codedmart merged commit ceaef97 into main Oct 5, 2025
2 of 3 checks passed
@codedmart codedmart deleted the djh/fix-multiple-relationships-to-the-same-collection branch October 5, 2025 23:34
GavinRay97 added a commit to hasura/ndc-hub that referenced this pull request May 6, 2026
Bumps the MySQL connector to **v1.0.19**.

> Re-opened from #742 on an upstream branch — fork PRs fail CI because
GitHub Actions strips repo/org secrets from `pull_request` runs
originating in forks.

## Changes

Picks up
[hasura/ndc-jvm-mono#97](hasura/ndc-jvm-mono#97)
— *fix(mysql): apply unique table alias on self-referential relationship
subqueries*.

When a relationship's source and target are the same collection (e.g.
`regions.parentRegionId → regions.id`), the correlated subquery was
previously aliased with the same name as the outer table scan. MySQL
resolved both sides of the join condition to the inner scope, producing
a tautological self-comparison that silently returned no rows.

Equivalent fix to [#88](hasura/ndc-jvm-mono#88)
(Snowflake/Trino) applied to MySQL's `JSONGenerator.kt`.

## Release artifacts

- Tag:
[`mysql/v1.0.19`](https://github.com/hasura/ndc-jvm-mono/releases/tag/mysql/v1.0.19)
- Image: `ghcr.io/hasura/ndc-jvm-mysql:v1.0.19` (linux/amd64,
linux/arm64)
- CLI: `ghcr.io/hasura/ndc-jvm-cli:v1.0.19-mysql`
- Source commit: `631d37452f26c736ed073c04bdce37d55bbff814`
- Tarball sha256:
`abfaf09c97327fe5d6bd1e98ba4df2c6d6fd5577c5f60d8b00d3ee10f8b28af0`

Original contributor: @qamar-hashmi.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.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.

3 participants