-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add all relevant predicates tests from ndc-postgres
- Loading branch information
1 parent
1a69e90
commit 02636bf
Showing
10 changed files
with
366 additions
and
2 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
crates/ndc-sqlserver/tests/goldenfiles/select_where_and.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,40 @@ | ||
{ | ||
"collection": "Album", | ||
"query": { | ||
"fields": { "Title": { "type": "column", "column": "Title" } }, | ||
"where": { | ||
"type": "and", | ||
"expressions": [ | ||
{ | ||
"type": "and", | ||
"expressions": [ | ||
{ | ||
"type": "and", | ||
"expressions": [ | ||
{ | ||
"type": "binary_comparison_operator", | ||
"column": { "type": "column", "name": "Title", "path": [] }, | ||
"operator": { "type": "other", "name": "_like" }, | ||
"value": { "type": "scalar", "value": "Van %" } | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "and", | ||
"expressions": [ | ||
{ | ||
"type": "binary_comparison_operator", | ||
"column": { "type": "column", "name": "Title", "path": [] }, | ||
"operator": { "type": "other", "name": "_like" }, | ||
"value": { "type": "scalar", "value": "% Halen III" } | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"arguments": {}, | ||
"collection_relationships": {} | ||
} |
87 changes: 87 additions & 0 deletions
87
crates/ndc-sqlserver/tests/goldenfiles/select_where_array_relationship.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,87 @@ | ||
{ | ||
"collection": "Artist", | ||
"query": { | ||
"fields": { | ||
"title": { | ||
"type": "column", | ||
"column": "Name", | ||
"arguments": {} | ||
}, | ||
"albums": { | ||
"type": "relationship", | ||
"relationship": "Artist_Albums", | ||
"arguments": {}, | ||
"query": { | ||
"fields": { | ||
"title": { | ||
"type": "column", | ||
"column": "Title", | ||
"arguments": {} | ||
} | ||
}, | ||
"order_by": { | ||
"elements": [ | ||
{ | ||
"order_direction": "asc", | ||
"target": { | ||
"type": "column", | ||
"name": "AlbumId", | ||
"path": [] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"where": { | ||
"type": "binary_comparison_operator", | ||
"column": { | ||
"type": "column", | ||
"name": "Title", | ||
"path": [ | ||
{ | ||
"relationship": "Artist_Albums", | ||
"arguments": {}, | ||
"predicate": { | ||
"type": "and", | ||
"expressions": [] | ||
} | ||
} | ||
] | ||
}, | ||
"operator": { | ||
"type": "other", | ||
"name": "_like" | ||
}, | ||
"value": { | ||
"type": "scalar", | ||
"value": "Supernatural" | ||
} | ||
}, | ||
"order_by": { | ||
"elements": [ | ||
{ | ||
"order_direction": "asc", | ||
"target": { | ||
"type": "column", | ||
"name": "ArtistId", | ||
"path": [] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"arguments": {}, | ||
"collection_relationships": { | ||
"Artist_Albums": { | ||
"arguments": {}, | ||
"column_mapping": { | ||
"ArtistId": "ArtistId" | ||
}, | ||
"relationship_type": "array", | ||
"source_collection_or_type": "Artist", | ||
"target_collection": "Album" | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
crates/ndc-sqlserver/tests/goldenfiles/select_where_name_eq.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,35 @@ | ||
{ | ||
"collection": "Album", | ||
"query": { | ||
"limit": 5, | ||
"fields": { | ||
"AlbumId": { | ||
"type": "column", | ||
"column": "AlbumId", | ||
"arguments": {} | ||
}, | ||
"Title": { | ||
"type": "column", | ||
"column": "Title", | ||
"arguments": {} | ||
} | ||
}, | ||
"where": { | ||
"type": "binary_comparison_operator", | ||
"column": { | ||
"type": "column", | ||
"name": "Title", | ||
"path": [] | ||
}, | ||
"operator": { | ||
"type": "equal" | ||
}, | ||
"value": { | ||
"type": "scalar", | ||
"value": "Houses Of The Holy" | ||
} | ||
} | ||
}, | ||
"arguments": {}, | ||
"collection_relationships": {} | ||
} |
49 changes: 49 additions & 0 deletions
49
crates/ndc-sqlserver/tests/goldenfiles/select_where_name_neq.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,49 @@ | ||
{ | ||
"collection": "Album", | ||
"query": { | ||
"fields": { | ||
"AlbumId": { | ||
"type": "column", | ||
"column": "AlbumId", | ||
"arguments": {} | ||
}, | ||
"Title": { | ||
"type": "column", | ||
"column": "Title", | ||
"arguments": {} | ||
} | ||
}, | ||
"where": { | ||
"type": "binary_comparison_operator", | ||
"column": { | ||
"type": "column", | ||
"name": "Title", | ||
"path": [] | ||
}, | ||
"operator": { | ||
"type": "other", | ||
"name": "_neq" | ||
}, | ||
"value": { | ||
"type": "scalar", | ||
"value": "Houses Of The Holy" | ||
} | ||
}, | ||
"order_by": { | ||
"elements": [ | ||
{ | ||
"order_direction": "asc", | ||
"target": { | ||
"type": "column", | ||
"name": "AlbumId", | ||
"path": [] | ||
} | ||
} | ||
] | ||
}, | ||
"limit": 5, | ||
"offset": 125 | ||
}, | ||
"arguments": {}, | ||
"collection_relationships": {} | ||
} |
52 changes: 52 additions & 0 deletions
52
crates/ndc-sqlserver/tests/goldenfiles/select_where_or.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,52 @@ | ||
{ | ||
"collection": "Album", | ||
"query": { | ||
"fields": { "Title": { "type": "column", "column": "Title" } }, | ||
"where": { | ||
"type": "and", | ||
"expressions": [ | ||
{ | ||
"type": "or", | ||
"expressions": [ | ||
{ | ||
"type": "and", | ||
"expressions": [ | ||
{ | ||
"type": "binary_comparison_operator", | ||
"column": { "type": "column", "name": "Title", "path": [] }, | ||
"operator": { "type": "equal" }, | ||
"value": { "type": "scalar", "value": "IV" } | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "and", | ||
"expressions": [ | ||
{ | ||
"type": "binary_comparison_operator", | ||
"column": { "type": "column", "name": "Title", "path": [] }, | ||
"operator": { "type": "equal" }, | ||
"value": { "type": "scalar", "value": "Van Halen III" } | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"order_by": { | ||
"elements": [ | ||
{ | ||
"order_direction": "asc", | ||
"target": { | ||
"type": "column", | ||
"name": "AlbumId", | ||
"path": [] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"arguments": {}, | ||
"collection_relationships": {} | ||
} |
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
13 changes: 13 additions & 0 deletions
13
crates/ndc-sqlserver/tests/snapshots/query_tests__predicates__select_where_and.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,13 @@ | ||
--- | ||
source: crates/ndc-sqlserver/tests/query_tests.rs | ||
expression: result | ||
--- | ||
[ | ||
{ | ||
"rows": [ | ||
{ | ||
"Title": "Van Halen III" | ||
} | ||
] | ||
} | ||
] |
14 changes: 14 additions & 0 deletions
14
crates/ndc-sqlserver/tests/snapshots/query_tests__predicates__select_where_name_eq.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,14 @@ | ||
--- | ||
source: crates/ndc-sqlserver/tests/query_tests.rs | ||
expression: result | ||
--- | ||
[ | ||
{ | ||
"rows": [ | ||
{ | ||
"AlbumId": 129, | ||
"Title": "Houses Of The Holy" | ||
} | ||
] | ||
} | ||
] |
30 changes: 30 additions & 0 deletions
30
crates/ndc-sqlserver/tests/snapshots/query_tests__predicates__select_where_name_neq.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,30 @@ | ||
--- | ||
source: crates/ndc-sqlserver/tests/query_tests.rs | ||
expression: result | ||
--- | ||
[ | ||
{ | ||
"rows": [ | ||
{ | ||
"AlbumId": 126, | ||
"Title": "Unplugged [Live]" | ||
}, | ||
{ | ||
"AlbumId": 127, | ||
"Title": "BBC Sessions [Disc 2] [Live]" | ||
}, | ||
{ | ||
"AlbumId": 128, | ||
"Title": "Coda" | ||
}, | ||
{ | ||
"AlbumId": 130, | ||
"Title": "In Through The Out Door" | ||
}, | ||
{ | ||
"AlbumId": 131, | ||
"Title": "IV" | ||
} | ||
] | ||
} | ||
] |
16 changes: 16 additions & 0 deletions
16
crates/ndc-sqlserver/tests/snapshots/query_tests__predicates__select_where_or.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,16 @@ | ||
--- | ||
source: crates/ndc-sqlserver/tests/query_tests.rs | ||
expression: result | ||
--- | ||
[ | ||
{ | ||
"rows": [ | ||
{ | ||
"Title": "IV" | ||
}, | ||
{ | ||
"Title": "Van Halen III" | ||
} | ||
] | ||
} | ||
] |