-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test all the things, (almost) everywhere
- Loading branch information
Showing
48 changed files
with
3,742 additions
and
74 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
...es/query-engine/translation/tests/goldenfiles/select_composite_column_simple/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,22 @@ | ||
{ | ||
"collection": "address_identity_function", | ||
"query": { | ||
"fields": { | ||
"result": { | ||
"type": "column", | ||
"column": "result", | ||
"arguments": {} | ||
} | ||
} | ||
}, | ||
"arguments": { | ||
"address": { | ||
"type": "literal", | ||
"value": { | ||
"address_line_1": "Somstreet 159", | ||
"address_line_2": "Second door to the right" | ||
} | ||
} | ||
}, | ||
"collection_relationships": {} | ||
} |
47 changes: 47 additions & 0 deletions
47
crates/query-engine/translation/tests/goldenfiles/select_composite_column_simple/tables.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,47 @@ | ||
{ | ||
"compositeTypes": { | ||
"person_address": { | ||
"name": "person_address", | ||
"fields": { | ||
"address_line_1": { | ||
"name": "address_line_1", | ||
"type": { | ||
"scalarType": "text" | ||
} | ||
}, | ||
"address_line_2": { | ||
"name": "address_line_2", | ||
"type": { | ||
"scalarType": "text" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"nativeQueries": { | ||
"address_identity_function": { | ||
"sql": "SELECT {{address}} as result", | ||
"columns": { | ||
"result": { | ||
"name": "result", | ||
"type": { | ||
"compositeType": "person_address" | ||
}, | ||
"nullable": "nullable", | ||
"description": null | ||
} | ||
}, | ||
"arguments": { | ||
"address": { | ||
"name": "address", | ||
"type": { | ||
"compositeType": "person_address" | ||
}, | ||
"nullable": "nullable", | ||
"description": null | ||
} | ||
}, | ||
"description": "A native query used to test support for composite types" | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
.../query-engine/translation/tests/goldenfiles/select_composite_variable_simple/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,33 @@ | ||
{ | ||
"collection": "address_identity_function", | ||
"query": { | ||
"fields": { | ||
"result": { | ||
"type": "column", | ||
"column": "result", | ||
"arguments": {} | ||
} | ||
} | ||
}, | ||
"arguments": { | ||
"address": { | ||
"type": "variable", | ||
"name": "variable_address" | ||
} | ||
}, | ||
"collection_relationships": {}, | ||
"variables": [ | ||
{ | ||
"variable_address": { | ||
"address_line_1": "Somstreet 159", | ||
"address_line_2": "Second door to the right" | ||
} | ||
}, | ||
{ | ||
"variable_address": { | ||
"address_line_1": "Somstreet 159", | ||
"address_line_2": "Second door to the right" | ||
} | ||
} | ||
] | ||
} |
47 changes: 47 additions & 0 deletions
47
...s/query-engine/translation/tests/goldenfiles/select_composite_variable_simple/tables.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,47 @@ | ||
{ | ||
"compositeTypes": { | ||
"person_address": { | ||
"name": "person_address", | ||
"fields": { | ||
"address_line_1": { | ||
"name": "address_line_1", | ||
"type": { | ||
"scalarType": "text" | ||
} | ||
}, | ||
"address_line_2": { | ||
"name": "address_line_2", | ||
"type": { | ||
"scalarType": "text" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"nativeQueries": { | ||
"address_identity_function": { | ||
"sql": "SELECT {{address}} as result", | ||
"columns": { | ||
"result": { | ||
"name": "result", | ||
"type": { | ||
"compositeType": "person_address" | ||
}, | ||
"nullable": "nullable", | ||
"description": null | ||
} | ||
}, | ||
"arguments": { | ||
"address": { | ||
"name": "address", | ||
"type": { | ||
"compositeType": "person_address" | ||
}, | ||
"nullable": "nullable", | ||
"description": null | ||
} | ||
}, | ||
"description": "A native query used to test support for composite types" | ||
} | ||
} | ||
} |
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
crates/query-engine/translation/tests/snapshots/tests__select_composite_column_simple.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,29 @@ | ||
--- | ||
source: crates/query-engine/translation/tests/tests.rs | ||
expression: result | ||
--- | ||
WITH "%1_NATIVE_QUERY_address_identity_function" AS ( | ||
SELECT | ||
jsonb_populate_record(cast(null as person_address), $1) as result | ||
) | ||
SELECT | ||
coalesce(json_agg(row_to_json("%2_universe")), '[]') AS "universe" | ||
FROM | ||
( | ||
SELECT | ||
* | ||
FROM | ||
( | ||
SELECT | ||
coalesce(json_agg(row_to_json("%3_rows")), '[]') AS "rows" | ||
FROM | ||
( | ||
SELECT | ||
"%0_address_identity_function"."result" AS "result" | ||
FROM | ||
"%1_NATIVE_QUERY_address_identity_function" AS "%0_address_identity_function" | ||
) AS "%3_rows" | ||
) AS "%3_rows" | ||
) AS "%2_universe" | ||
|
||
[(1, Value(Object {"address_line_1": String("Somstreet 159"), "address_line_2": String("Second door to the right")}))] |
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
crates/query-engine/translation/tests/snapshots/tests__select_composite_variable_simple.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,40 @@ | ||
--- | ||
source: crates/query-engine/translation/tests/tests.rs | ||
expression: result | ||
--- | ||
SELECT | ||
coalesce(json_agg("%6_universe_agg"."universe"), '[]') AS "universe" | ||
FROM | ||
( | ||
SELECT | ||
row_to_json("%3_universe") AS "universe" | ||
FROM | ||
jsonb_to_recordset($1) AS "%0_%variables_table"("%variable_order" int, "%variables" jsonb) | ||
CROSS JOIN LATERAL ( | ||
WITH "%2_NATIVE_QUERY_address_identity_function" AS ( | ||
SELECT | ||
jsonb_populate_record( | ||
cast(null as person_address), | ||
("%0_%variables_table"."%variables" -> $2) | ||
) as result | ||
) | ||
SELECT | ||
* | ||
FROM | ||
( | ||
SELECT | ||
coalesce(json_agg(row_to_json("%4_rows")), '[]') AS "rows" | ||
FROM | ||
( | ||
SELECT | ||
"%1_address_identity_function"."result" AS "result" | ||
FROM | ||
"%2_NATIVE_QUERY_address_identity_function" AS "%1_address_identity_function" | ||
) AS "%4_rows" | ||
) AS "%4_rows" | ||
) AS "%3_universe" | ||
ORDER BY | ||
"%0_%variables_table"."%variable_order" ASC | ||
) AS "%6_universe_agg" | ||
|
||
[(1, Variable("%VARIABLES_OBJECT_PLACEHOLDER")), (2, String("variable_address"))] |
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
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
...snapshots/databases_tests__citus__query_tests__basic__select_composite_column_simple.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/tests/databases-tests/src/citus/query_tests.rs | ||
expression: result | ||
--- | ||
[ | ||
{ | ||
"rows": [ | ||
{ | ||
"result": { | ||
"address_line_1": "Somstreet 159", | ||
"address_line_2": "Second door to the right" | ||
} | ||
} | ||
] | ||
} | ||
] |
File renamed without changes.
26 changes: 26 additions & 0 deletions
26
...apshots/databases_tests__citus__query_tests__basic__select_composite_variable_simple.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,26 @@ | ||
--- | ||
source: crates/tests/databases-tests/src/citus/query_tests.rs | ||
expression: result | ||
--- | ||
[ | ||
{ | ||
"rows": [ | ||
{ | ||
"result": { | ||
"address_line_1": "Somstreet 159", | ||
"address_line_2": "Second door to the right" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"rows": [ | ||
{ | ||
"result": { | ||
"address_line_1": "Somstreet 159", | ||
"address_line_2": "Second door to the right" | ||
} | ||
} | ||
] | ||
} | ||
] |
Oops, something went wrong.