-
Notifications
You must be signed in to change notification settings - Fork 359
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
refactor: remove junctions from query engine API [DHIS2-18041] #20008
base: master
Are you sure you want to change the base?
Conversation
|
disjunctions.add(disjunction); | ||
} | ||
return disjunctions; | ||
private Restriction getDisjunctionsFromCustomMentions(List<String> mentions, Schema schema) { |
Check notice
Code scanning / CodeQL
Useless parameter Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 3 days ago
To fix the problem, we need to remove the unused parameter Schema schema
from the method getDisjunctionsFromCustomMentions
. This involves:
- Removing the parameter from the method signature.
- Updating any calls to this method to remove the corresponding argument.
This change will simplify the method and its usage without altering its functionality.
-
Copy modified line R162
@@ -161,3 +161,3 @@ | ||
|
||
private Restriction getDisjunctionsFromCustomMentions(List<String> mentions, Schema schema) { | ||
private Restriction getDisjunctionsFromCustomMentions(List<String> mentions) { | ||
List<String> items = new ArrayList<>(); |
@ToString(onlyExplicitlyIncluded = true) | ||
public class Query { | ||
|
||
@ToString.Include private final List<Restriction> criterions = new ArrayList<>(); |
Check notice
Code scanning / CodeQL
Exposing internal representation Note
Summary
Fixes special filters that would require junctions by moving their composition into the query engine.
While this refactoring removes nested junctions from the query engine API this does not remove a web API feature. Nested junctions were only used in a few special programmatic cases to build more sophisticated filters. Within the
Query
all filters are now just oneRestriction
. Sophisticated ones are expanded first within the engine making it unnecessary to model junctions on theQuery
orRestriction
level.To distinguish
Restriction
s that are simple from those that need expanding theisVirtual()
method got added encoding the few conditions where this is needed.Simplifications
Criteria
,Criterion
,Disjunction
andConjunction
as all filters are now simpleRestriction
sQuery
but extracted from theRestriction
in the JPA query engine when neededTyped
got replaced by simply usingList.of
Operator.collectionArgs
was replaced with usingOperator.args
instead (there never was a need for another field as only in/not-in operator would use it and they always would only have one list of args that could useargs
as all other operators)QueryPlanner.planQuery
withpersistedOnly
got removed (this was never necessary asQuery
instances passed to aQueryEngine
should always be already planned as they should come from within theQueryService
and never be passed to the engine directly)Corrections
DefaultJpaQueryParser
got renamed toDefaultQueryParser
(wasn't specific to JPA in any way)QueryEngine
generic got removed (it was wrongly made generic when it was not)Operator
got changed from<T extends Comparable<? super T>>
to<T extends Comparable<T>>
(was too unspecific which forced some casts that now can be avoided)Cleanup
QueryPath
got moved into the schema module and is not computed by theSchemaService
(as it really as an extension onSchema
andProperty
that is only used forQuery
)QueryService.query
withResultTransformer
got removed (was unused)Operator.getHibernateCriterion
got removed (was unused)