-
-
Notifications
You must be signed in to change notification settings - Fork 748
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
Allow empty filter expressions to be visited #5214
Allow empty filter expressions to be visited #5214
Conversation
Hey @david-driscoll, main is 13. We have a branch called We are holding off on merging this PR for this week since we have a large PR coming in introducing the new V13 execution engine. I will merge your PR once we have #5168 in. Probably after the weekend. |
I'll wait for the review, but if this is a change that would benefit version 12 I can rebase the branch from there. Is there a process to then get those changes merged up into main or is that something ya'll handle I assume. |
@david-driscoll sorry for this taking so long :) I would like to know how you guys see this @david-driscoll @michaelstaib
Can you share this? Maybe i can show you how to plug this into the filtering directly :) This would mean (if it works) you would not require a middleware and could directly alter the expression generation :) |
@PascalSenn A where with no conditions would effectively behave like Now to the core problem of with queryable projection as it exists today is that it creates a single predicate to the applied to the In my case RavenDB has a special A copy of the code is here: https://github.com/david-driscoll/raven-hc-spatial So in order to properly call this method, in the best way I could figure out.
The code change in this pull request was specifically targeted to do two things. It no longer throws an exception if the where clause is empty or if the where clause produced operation no expressions. The handlers and operations still have to be known by the graph schema. This then gives the flexibility to do something a little out of the ordinary with that expression data elsewhere in the pipeline. |
Sorting was done very similarly, however when sorting is applied to the queryable it does not throw in the same manner as QueryableCombiner. If there are zero expressions returned it just returns the source expression. |
@david-driscoll Regarding the GraphQL specification, it does not really have a behaviour defined for these use cases. Filter is built on top of GraphQL. I aligned the behaviour across the different providers (Mongodb and Neo4j). they also now allow @michaelstaib i did a breaking api change there as we do not longer need |
src/HotChocolate/MongoDb/src/Data/Extensions/MongoFilterVisitorContextExtensions.cs
Outdated
Show resolved
Hide resolved
src/HotChocolate/MongoDb/src/Data/Extensions/MongoFilterVisitorContextExtensions.cs
Show resolved
Hide resolved
src/HotChocolate/MongoDb/test/Data.MongoDb.Filters.Tests/MongoDbFilterCombinatorTests.cs
Outdated
Show resolved
Hide resolved
@PascalSenn if we want this change on 12 no breaking changes please. |
sure thing, this will only go to main |
if we want to backport this to 12 we can easily make it non breaking |
@PascalSenn for main I can merge it ... but david wants it on the v12 branch as well. |
/AzurePipelines run |
Azure Pipelines successfully started running 3 pipeline(s). |
…rContextExtensions.cs
…DbFilterCombinatorTests.cs
/AzurePipelines run |
Azure Pipelines successfully started running 2 pipeline(s), but failed to run 1 pipeline(s). |
/AzurePipelines run |
Azure Pipelines successfully started running 3 pipeline(s). |
@PascalSenn can you have a look at the Data test errors? Neo4J is OK, is source gen failed on build ... this is just a build issue. But Data has a single error that you have to review. |
CodeQL also has issues with the source generators ... this seams to be related to the .NET 7 Upgrade. We will fix that in a separate PR |
@david-driscoll pascal will port this one back to the version 12 branch. |
QueryableCombinator.TryCombineOperations
never actually "tries" anything. It either succeeds or throws.I'm working on integrating Raven Db with HotChocolate and everything is going fairly well however I ran into a strange case (unique to how Raven does things vs other databases). Spatial queries are done directly on the
IQueryable
instance instead of as part of the expression itself. I have solved this part of the problem using additional middleware. (If anyone is interested let me know, it was fun, I've solved spatial filtering and spatial sorting!). The problem here is that my middleware happens after the filter middleware, and for filtering to work today it must always have some expression added to the tree. Well Raven hatesExpression.Constant(true)
, so I had to go digging.The next problem I'm now running into is
QueryableCombinator.TryCombineOperations
never actually "tries" anything. Instead of setting the output parameter to null and returning false it simply throws if the collection is zero. This disallows filters that are simply emptyroot(where: {})
or in my case filters that are skipped and simply handled elsewhere in middleware. I also found this issue and it turned out to be related.During testing it became apparent this was solving an issue and causing some side-effects, but as I reviewed the snapshots, they were errors which I think (hope! 🤣) are unexpected.
Please let me know if you have any questions or concerns. I wasn't sure if there was a branch to support targeting 12 or if it will just be version 13 forward, I can work with that too.
🥳 🎉
Closes #1705