Repository navigation
ENGTAI-68310 : Adding logic and fixing order #232
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
df6fedf
Adding logic and fixing order
Sukhamjot-Singh 8768d6e
Added test
Sukhamjot-Singh d53cc4e
postgres fix
Sukhamjot-Singh 36862c5
Merge branch 'main' into not-in-query
suresh-prakash 3284d79
Merge branch 'main' into not-in-query
Sukhamjot-Singh 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 hidden or 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
18 changes: 18 additions & 0 deletions
18
...ent-store/src/integrationTest/resources/query/array_operators/environment_ids_subset.json
This file contains hidden or 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,18 @@ | ||
| [ | ||
| { | ||
| "scope": { | ||
| "environmentScope": { | ||
| "environmentIds": ["env-1", "env-2"] | ||
| } | ||
| }, | ||
| "name": "Document A" | ||
| }, | ||
| { | ||
| "scope": { | ||
| "environmentScope": { | ||
| "environmentIds": ["env-1", "env-2", "env-3"] | ||
| } | ||
| }, | ||
| "name": "Document B" | ||
| } | ||
| ] |
42 changes: 42 additions & 0 deletions
42
...ent-store/src/integrationTest/resources/query/array_operators/environment_scope_test.json
This file contains hidden or 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,42 @@ | ||
| [ | ||
| { | ||
| "_id": 1, | ||
| "name": "Document A", | ||
| "scope": { | ||
| "environmentScope": { | ||
| "environmentIds": ["env-1", "env-2"] | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "_id": 2, | ||
| "name": "Document B", | ||
| "scope": { | ||
| "environmentScope": { | ||
| "environmentIds": ["env-1", "env-2", "env-3"] | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "_id": 3, | ||
| "name": "Document C", | ||
| "scope": { | ||
| "environmentScope": { | ||
| "environmentIds": ["env-1", "env-4"] | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "_id": 4, | ||
| "name": "Document D", | ||
| "scope": { | ||
| "environmentScope": { | ||
| "environmentIds": ["env-5", "env-6"] | ||
| } | ||
| } | ||
| }, | ||
| { | ||
| "_id": 5, | ||
| "name": "Document E" | ||
| } | ||
| ] |
26 changes: 26 additions & 0 deletions
26
...ce/core/documentstore/mongo/query/parser/filter/MongoNotInExprRelationalFilterParser.java
This file contains hidden or 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,26 @@ | ||
| package org.hypertrace.core.documentstore.mongo.query.parser.filter; | ||
|
|
||
| import java.util.Map; | ||
| import lombok.AllArgsConstructor; | ||
| import org.hypertrace.core.documentstore.expression.impl.RelationalExpression; | ||
| import org.hypertrace.core.documentstore.mongo.query.parser.filter.MongoRelationalFilterParserFactory.MongoRelationalFilterContext; | ||
|
|
||
| /** | ||
| * Note: MongoDB does not have a native "NOT IN" aggregation operator. This parser simulates "NOT | ||
| * IN" functionality by combining the $not and $in operators. | ||
| */ | ||
| @AllArgsConstructor | ||
| public class MongoNotInExprRelationalFilterParser implements MongoRelationalFilterParser { | ||
| private static final String NOT_OP = "$not"; | ||
| private static final String IN_OP = "$in"; | ||
| private static final MongoStandardRelationalOperatorMapping mapping = | ||
| new MongoStandardRelationalOperatorMapping(); | ||
|
|
||
| @Override | ||
| public Map<String, Object> parse( | ||
| final RelationalExpression expression, final MongoRelationalFilterContext context) { | ||
| final String parsedLhs = expression.getLhs().accept(context.lhsParser()); | ||
| final Object parsedRhs = expression.getRhs().accept(context.rhsParser()); | ||
| return Map.of(NOT_OP, Map.of(IN_OP, new Object[] {parsedLhs, parsedRhs})); | ||
| } | ||
| } |
This file contains hidden or 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
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.
Anything we build in document-store needs to be compatible with Postgres too to avoid digressing them too much. Could you please sync. with the respective team to get this working on Postgres too? I believe that should be a smaller fix too.