Skip to content
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

Add new test queries #421

Merged
merged 12 commits into from
Aug 2, 2023
Merged

Add new test queries #421

merged 12 commits into from
Aug 2, 2023

Conversation

u9g
Copy link
Contributor

@u9g u9g commented Aug 2, 2023

No description provided.

Copy link
Owner

@obi1kenobi obi1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions on how to get more testing power out of the tests, otherwise happy to merge.

Copy link
Owner

@obi1kenobi obi1kenobi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider (either here or in a separate PR) also including a test case where there is both a >= and a <= filter on the count and there's no outputs in the fold. It would make sure the new optimization doesn't kick in in situations where the count can be observed indirectly via a filter that could flip from passing to not passing as the count grows.

Two variations worth testing here:

  • when we count to a number that clears the >=, and then hit the end of the @fold iterator before we hit the <= number, the result is returned
  • when we exceed the <= number, we stop counting immediately regardless of everything else

Another variation of that test case: have both a >= and a one_of filter. In this case, we need the exact count always, because that's the only way to match the one_of filter.

Comment on lines 3 to 9
// This @fold statement doesn't actually need to fully evaluate:
// it has no outputs, and the predicate can be determined to be satisfied
// with only a partial evaluation of the @fold.
//
// The number 30 is composite and has 3 prime factors: 2, 3, 5.
// This test checks whether the evaluation of the @fold is stopped early
// after two of those three primes are produced (satisfying the predicate).
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not true — in fact the opposite is true. The @output on the count requires us to fully evaluate the @fold, or else we don't know what the count is.

Did you mean to put this comment in a different file?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's from an earlier test that I copied, not meant to be here after I added the @output. I've fixed it :)

Comment on lines +1 to +18
TestGraphQLQuery (
schema_name: "numbers",
query: r#"
{
Number(min: 30, max: 30) {
... on Composite {
value @output

primeFactor @fold @transform(op: "count") @filter(op: "<", value: ["$min_primes"]) {
prime: value @output
}
}
}
}"#,
arguments: {
"min_primes": Uint64(2)
},
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this test case is testing? Also it seems to have no results because the < 2 predicate on the fold filters everything out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the same test case for > and <, I didn't think it would be a problem to add another behavioral test case to ensure no breaks in existing behavior.

@obi1kenobi obi1kenobi merged commit ab840bb into obi1kenobi:main Aug 2, 2023
18 checks passed
@u9g u9g deleted the more-test-queries branch August 2, 2023 14:36
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.

None yet

2 participants