-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support all comparison and aggregation functions on extended json fields #99
Merged
hallettj
merged 10 commits into
main
from
jessehallett/ndc-378-support-equality-comparisons-for-extendedjson
Aug 26, 2024
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1a52cba
enable all aggregation and comparison functions for extended json
hallettj ac5ee70
add ddn cli to dev shell
hallettj 0499cb3
update metadata, add native query with extended json test data
hallettj 4f13450
wip:
hallettj d67ba3c
get cli from hasura repo
hallettj 8b899fc
integration tests
hallettj ae0ff46
update changelog
hallettj 24b555e
skip tests in mongodb 5
hallettj 9e31e58
fix typo in changelog
hallettj a687aed
add filtering integration test
hallettj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use insta::assert_yaml_snapshot; | ||
use serde_json::json; | ||
|
||
use crate::graphql_query; | ||
|
||
#[tokio::test] | ||
async fn filters_on_extended_json_using_string_comparison() -> anyhow::Result<()> { | ||
// Skip this test in MongoDB 5 because the example fails there. We're getting an error: | ||
// | ||
// > Kind: Command failed: Error code 5491300 (Location5491300): $documents' is not allowed in user requests, labels: {} | ||
// | ||
// This doesn't affect native queries that don't use the $documents stage. | ||
if let Ok(image) = std::env::var("MONGODB_IMAGE") { | ||
if image == "mongo:5" { | ||
return Ok(()); | ||
} | ||
} | ||
|
||
assert_yaml_snapshot!( | ||
graphql_query( | ||
r#" | ||
query Filtering { | ||
extendedJsonTestData(where: { value: { _regex: "hello" } }) { | ||
type | ||
value | ||
} | ||
} | ||
"# | ||
) | ||
.variables(json!({ "types": "double|null" })) | ||
.run() | ||
.await? | ||
); | ||
Ok(()) | ||
} |
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
43 changes: 43 additions & 0 deletions
43
...__tests__aggregation__aggregates_extended_json_representing_mixture_of_numeric_types.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,43 @@ | ||
--- | ||
source: crates/integration-tests/src/tests/aggregation.rs | ||
expression: "graphql_query(r#\"\n query ($types: String!) {\n extendedJsonTestDataAggregate(\n filter_input: { where: { type: { _regex: $types } } }\n ) {\n value {\n _avg\n _count\n _max\n _min\n _sum\n _count_distinct\n }\n }\n extendedJsonTestData(where: { type: { _regex: $types } }) {\n type\n value\n }\n }\n \"#).variables(json!({\n \"types\": \"decimal|double|int|long\"\n })).run().await?" | ||
--- | ||
data: | ||
extendedJsonTestDataAggregate: | ||
value: | ||
_avg: | ||
$numberDecimal: "4.5" | ||
_count: 8 | ||
_max: | ||
$numberLong: "8" | ||
_min: | ||
$numberDecimal: "1" | ||
_sum: | ||
$numberDecimal: "36" | ||
_count_distinct: 8 | ||
extendedJsonTestData: | ||
- type: decimal | ||
value: | ||
$numberDecimal: "1" | ||
- type: decimal | ||
value: | ||
$numberDecimal: "2" | ||
- type: double | ||
value: | ||
$numberDouble: "3.0" | ||
- type: double | ||
value: | ||
$numberDouble: "4.0" | ||
- type: int | ||
value: | ||
$numberInt: "5" | ||
- type: int | ||
value: | ||
$numberInt: "6" | ||
- type: long | ||
value: | ||
$numberLong: "7" | ||
- type: long | ||
value: | ||
$numberLong: "8" | ||
errors: ~ |
27 changes: 27 additions & 0 deletions
27
...integration_tests__tests__aggregation__aggregates_mixture_of_numeric_and_null_values.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,27 @@ | ||
--- | ||
source: crates/integration-tests/src/tests/aggregation.rs | ||
expression: "graphql_query(r#\"\n query ($types: String!) {\n extendedJsonTestDataAggregate(\n filter_input: { where: { type: { _regex: $types } } }\n ) {\n value {\n _avg\n _count\n _max\n _min\n _sum\n _count_distinct\n }\n }\n extendedJsonTestData(where: { type: { _regex: $types } }) {\n type\n value\n }\n }\n \"#).variables(json!({\n \"types\": \"double|null\"\n })).run().await?" | ||
--- | ||
data: | ||
extendedJsonTestDataAggregate: | ||
value: | ||
_avg: | ||
$numberDouble: "3.5" | ||
_count: 2 | ||
_max: | ||
$numberDouble: "4.0" | ||
_min: | ||
$numberDouble: "3.0" | ||
_sum: | ||
$numberDouble: "7.0" | ||
_count_distinct: 2 | ||
extendedJsonTestData: | ||
- type: double | ||
value: | ||
$numberDouble: "3.0" | ||
- type: double | ||
value: | ||
$numberDouble: "4.0" | ||
- type: "null" | ||
value: ~ | ||
errors: ~ |
9 changes: 9 additions & 0 deletions
9
...ntegration_tests__tests__filtering__filters_on_extended_json_using_string_comparison.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,9 @@ | ||
--- | ||
source: crates/integration-tests/src/tests/filtering.rs | ||
expression: "graphql_query(r#\"\n query Filtering {\n extendedJsonTestData(where: { value: { _regex: \"hello\" } }) {\n type\n value\n }\n }\n \"#).variables(json!({\n \"types\": \"double|null\"\n })).run().await?" | ||
--- | ||
data: | ||
extendedJsonTestData: | ||
- type: string | ||
value: "hello, world!" | ||
errors: ~ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
kind: Subgraph | ||
version: v1 | ||
version: v2 | ||
definition: | ||
generator: | ||
rootPath: . | ||
|
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.