-
Notifications
You must be signed in to change notification settings - Fork 6
fix:addresses not_in filter query for array type field - attributes.lables #83
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #83 +/- ##
============================================
+ Coverage 57.38% 57.80% +0.41%
- Complexity 240 249 +9
============================================
Files 36 36
Lines 2619 2645 +26
Branches 352 354 +2
============================================
+ Hits 1503 1529 +26
Misses 954 954
Partials 162 162
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
avinashkolluru
left a comment
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.
Looks fine. But is there no integration test for this?
|
@kotharironak |
Yes. there is no integration test, but we can add. Let me do that. |
entity-service-impl/src/main/java/org/hypertrace/entity/service/util/DocStoreConverter.java
Show resolved
Hide resolved
entity-service-impl/src/main/java/org/hypertrace/entity/service/util/DocStoreConverter.java
Show resolved
Hide resolved
entity-service-impl/src/main/java/org/hypertrace/entity/service/util/DocStoreConverter.java
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
|
|
||
| Filter exists = new Filter(); | ||
| exists.setFieldName(fieldName); | ||
| exists.setOp(Op.EXISTS); |
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 am not exactly sure whether we need Exists or Not Exists here. Won't we want to return all the entities which do not have this field?
Here we are doing labels NOT IN [A, B]
- Do we only want to return entities which has labels but does not have A or B
- Or, do we also want to return entities where labels does not exist as well?
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 would think #2.
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.
@kotharironak In that case, we need to do "NOT_EXISTS OR the other filter"
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.
@skjindal93 Can you check this integration test - testNotInFilterForMatchingLabelsQuery? It has 5 documents. One doesn't have attributes.labels fields. Is it expected in the result?
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.
Can you check this integration test - testNotInFilterForMatchingLabelsQuery? It has 5 documents. One doesn't have attributes.labels fields. Is it expected in the result?
Yeah, createdEntity5 is expected in the result
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.
@skjindal93 I have added some more integration tests for NOT_IN, IN, and EQ - testDifferentFilterForMatchingLabelsQuery
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.
Yes @kotharironak That entity is expected in the result
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.
Made the changes. @avinashkolluru @skjindal93, now it's good to go. Have a look.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@avinashkolluru What is expected behavior here? The current implementation doesn't return. Check the test case |
This comment has been minimized.
This comment has been minimized.
| .build(); | ||
| entitiesList = entityDataServiceClient.query(TENANT_ID, query); | ||
| assertTrue(entitiesList.size() == 2); | ||
| assertTrue(entitiesList.contains(createdEntity2) && entitiesList.contains(createdEntity2)); |
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 think there is a typo here
entitiesList.contains(createdEntity2) && entitiesList.contains(createdEntity2)
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 think it should be
entitiesList.contains(createdEntity2) && entitiesList.contains(createdEntity5)
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.
Done. Good catch, while debugging, I had checked createdEntity5, but had gone back & forth changing this condition.
This comment has been minimized.
This comment has been minimized.
* Make the Query DTO equatable/hashable
Description
This PR addresses a gap for the handling of searching entities for not matching labels for array type field
attributes.labelsCurrently, we have support for searching entities for matching labels, but we need similar capabilities to search entities for not matching labels.
Currently, filtering entities for matching labels
attributes.labels IN (<val1> , <val2>)is translated toattributes.labels = <val1> OR attributes.labels = <val2> This PR adds support forattributes.labels NOT_IN ( , )by translating it intoattributes.labels != AND attributes.labels != `Testing
Data:
Query:
Checklist:
Documentation
None
Note
We have a ticket for adding
NOT_INfilter support in docstore interface - hypertrace/document-store#32