-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invalid joins when the order by relationship predicate is null
- Loading branch information
1 parent
e3f7a53
commit 1176e12
Showing
11 changed files
with
213 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
86 changes: 86 additions & 0 deletions
86
...n/tests/goldenfiles/sorting_by_relationship_column_with_true_predicate/configuration.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
"version": "4", | ||
"metadata": { | ||
"tables": { | ||
"Album": { | ||
"schemaName": "public", | ||
"tableName": "Album", | ||
"columns": { | ||
"AlbumId": { | ||
"name": "AlbumId", | ||
"type": { | ||
"scalarType": "int4" | ||
}, | ||
"nullable": "nullable", | ||
"description": null | ||
}, | ||
"ArtistId": { | ||
"name": "ArtistId", | ||
"type": { | ||
"scalarType": "int4" | ||
}, | ||
"nullable": "nullable", | ||
"description": null | ||
}, | ||
"Title": { | ||
"name": "Title", | ||
"type": { | ||
"scalarType": "varchar" | ||
}, | ||
"nullable": "nullable", | ||
"description": null | ||
} | ||
}, | ||
"uniquenessConstraints": {}, | ||
"foreignRelations": {}, | ||
"description": null | ||
}, | ||
"Artist": { | ||
"schemaName": "public", | ||
"tableName": "Artist", | ||
"columns": { | ||
"ArtistId": { | ||
"name": "ArtistId", | ||
"type": { | ||
"scalarType": "int4" | ||
}, | ||
"nullable": "nullable", | ||
"description": null | ||
}, | ||
"Name": { | ||
"name": "Name", | ||
"type": { | ||
"scalarType": "varchar" | ||
}, | ||
"nullable": "nullable", | ||
"description": null | ||
} | ||
}, | ||
"uniquenessConstraints": {}, | ||
"foreignRelations": {}, | ||
"description": null | ||
} | ||
}, | ||
"scalarTypes": { | ||
"int4": { | ||
"typeName": "int4", | ||
"schemaName": "pg_catalog", | ||
"description": null, | ||
"aggregateFunctions": {}, | ||
"comparisonOperators": {}, | ||
"typeRepresentation": null | ||
}, | ||
"varchar": { | ||
"typeName": "varchar", | ||
"schemaName": "pg_catalog", | ||
"description": null, | ||
"aggregateFunctions": {}, | ||
"comparisonOperators": {}, | ||
"typeRepresentation": null | ||
} | ||
}, | ||
"compositeTypes": {}, | ||
"nativeQueries": {} | ||
}, | ||
"mutationsVersion": null | ||
} |
46 changes: 46 additions & 0 deletions
46
...slation/tests/goldenfiles/sorting_by_relationship_column_with_true_predicate/request.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"collection": "Album", | ||
"query": { | ||
"fields": { | ||
"Name": { | ||
"type": "column", | ||
"column": "Title", | ||
"arguments": {} | ||
} | ||
}, | ||
"limit": 5, | ||
"offset": 3, | ||
"order_by": { | ||
"elements": [ | ||
{ | ||
"order_direction": "asc", | ||
"target": { | ||
"type": "column", | ||
"name": "Name", | ||
"path": [ | ||
{ | ||
"relationship": "AlbumArtist", | ||
"arguments": {}, | ||
"predicate": { | ||
"type": "and", | ||
"expressions": [] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"arguments": {}, | ||
"collection_relationships": { | ||
"AlbumArtist": { | ||
"column_mapping": { | ||
"ArtistId": "ArtistId" | ||
}, | ||
"relationship_type": "object", | ||
"target_collection": "Artist", | ||
"arguments": {} | ||
} | ||
} | ||
} |
This file contains 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
44 changes: 44 additions & 0 deletions
44
...ranslation/tests/snapshots/tests__sorting_by_relationship_column_with_true_predicate.snap
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
source: crates/query-engine/translation/tests/tests.rs | ||
expression: result | ||
--- | ||
SELECT | ||
coalesce(json_agg(row_to_json("%3_universe")), '[]') AS "universe" | ||
FROM | ||
( | ||
SELECT | ||
* | ||
FROM | ||
( | ||
SELECT | ||
coalesce(json_agg(row_to_json("%4_rows")), '[]') AS "rows" | ||
FROM | ||
( | ||
SELECT | ||
"%0_Album"."Title" AS "Name" | ||
FROM | ||
"public"."Album" AS "%0_Album" | ||
LEFT OUTER JOIN LATERAL ( | ||
SELECT | ||
"%1_ORDER_PART_Artist"."Name" AS "Name" | ||
FROM | ||
( | ||
SELECT | ||
"%1_ORDER_PART_Artist"."Name" AS "Name" | ||
FROM | ||
"public"."Artist" AS "%1_ORDER_PART_Artist" | ||
WHERE | ||
( | ||
"%0_Album"."ArtistId" = "%1_ORDER_PART_Artist"."ArtistId" | ||
) | ||
) AS "%1_ORDER_PART_Artist" | ||
) AS "%2_ORDER_FOR_Album" ON ('true') | ||
ORDER BY | ||
"%2_ORDER_FOR_Album"."Name" ASC | ||
LIMIT | ||
5 OFFSET 3 | ||
) AS "%4_rows" | ||
) AS "%4_rows" | ||
) AS "%3_universe"; | ||
|
||
{} |
This file contains 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