-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix compilation and execution for circular dependencies in input types #82
base: main
Are you sure you want to change the base?
Conversation
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.
I still need to think a bit more about the approach, I would love to have some benchmarks that stress query execution with highly nested variables (like the filter test in this PR) between master and this PR.
If this is punishing for the before case, maybe we can consider detecting the circular case in the types and bail out to such an implementation while relying on inline access for the normal case.
Hello, is there anything particular blocking this PR? It would unlock a lot of people if it can be merged. 🤞 |
@boopathi @ruiaraujo, is there any update about this PR? It would solve lots of issues for us |
Any plan to finalize and merge this PR ?? |
@boopathi @ruiaraujo What can we do in order to help this land? |
@boopathi Thanks for this awesome project but this issue and the PR have been open for 4 years. I'm trying to figure out what is the blocker here because we would like to help to get this issue resolved. How we can help to proceed with the solution and fix this issue? |
@BabakScript I think what is pending, is the missing benchmarks that @ruiaraujo was mentioning earlier.
@BabakScript would you be able to contribute the above benchmarks? |
@oporkka I guess as @boopathi mentioned the benchmarks part is somehow done. We didn't contribute to this project yet but we can try to read the code and check if we can help with the optimization part. BTW, Thanks @boopathi for the update. I guess #228 is also a promising and good approach. |
Previously the following schema would result in compilation error -
When input types are recursive in nature, the compilation depended on generating it inline. This PR hoists it to a function and generates it only once for input object types. This way, instead of relying on inlined object access, we have a getter and a setter defined at the top of the generated code -
getPath
andsetPath
- this moves the object access (the path -input["var"]["foo"]
) to runtime - via getPath and setPath - so as to pass different paths as we move down the tree.Extras:
Also, we compute the circular dependencies at runtime and throw them as separate user errors/ For this we now have the
Set
of visited inputs captured at the top-level. At the time of this writing, I've not handled the false positives where -var1.foo
is the same object asvar2.foo
- which does not form a circular dependency, but would still result in a circular dependency error. These forms of runtime values are unintended because variables are generally passed down via request and is most likely deserialized from JSON. A JSON.parse cannot result in such cases anyway.For the common case, we disable checking for runtime circular dependencies. To enable this, you can use the new compiler option