-
Notifications
You must be signed in to change notification settings - Fork 199
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 map field's prefix not being set in marqo__field_types when partial updating + add api tests #1144
base: mainline
Are you sure you want to change the base?
Fix map field's prefix not being set in marqo__field_types when partial updating + add api tests #1144
Conversation
…fields, adding new maps with docs resulted in map type issues & later didn't allow us to properly update maps in subsequent calls. Also added more robust testing where we are now testing the field_type metadata & running every test through 3 different docs
…n_uuid is updated everytime a map update happens.
mostly added more test cases and fixed logging in some existing ones
…n-uuid # Conflicts: # src/marqo/core/semi_structured_vespa_index/semi_structured_vespa_index.py # tests/integ_tests/core/document/test_partial_update_semi_structured.py
…maps concurrently
Reformating a testcase 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.
I don't think there's a test that covers the bug you're fixing in this PR
# Handle creating update statements for the map field name. | ||
if "." in field_name: | ||
# For fields like "map1.key1", extract the map name "map1" | ||
map_name = field_name.split(".", 1)[0] |
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.
Did we have this logic in a function that we could reuse?
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.
introduced a method for this.
@@ -453,12 +459,17 @@ def _create_update_statement_for_updating_numeric_and_numeric_map_field( | |||
if (original_field_name not in numeric_field_map and | |||
original_doc.fixed_fields.field_types.get(original_field_name) in (MarqoFieldTypes.INT_MAP.value, MarqoFieldTypes.FLOAT_MAP.value)): | |||
|
|||
map_name = original_field_name.split(".", 1)[0] |
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.
Should have a func rather than repeat the split logic. Probably even a func to detect if it's a map (contains .
)
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.
introduced a method for this.
self.assertEqual(get_docs_response['new_float_map.e'], 2.718) | ||
|
||
def test_add_new_tensor_fields_with_update_documents_api(self): | ||
"""Test that adding new tensor fields, string arrays, and strings via update_documents fails. |
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 in general you're putting too many things in your tests. This one for example looks like at least three separate tests. In general if you have a lot of asserts, you're probably testing too many things at once.
Also print statement in test is unusual and not good practice usually. If there's an issue, raise an error and have the string as its message
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've broken down some tests that I could see fit. Please let me know if you think any other tests can be split also.
Deleted all print statements. Some are still there in the tests with threads and can help in debugging. let me know if you want me to delete them.
What is the current behavior? (You can also link to an open issue here)
wrt the bug - currently if a map is inserted via a partial update (it must not exist from before), the marqo__field_types will consist of int_map.key1, int_map.key2 but no int_map. This doesn't happen when inserting maps via add_docs and is critical to prevent type conversions.
What is the new behavior (if this is a feature change)?
if a map is inserted via a partial update (it must not exist from before), the marqo__field_types will consist of int_map.key1: int_map_entry, int_map.key2: int_map_entry & int_map: int_map_entry.
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No
Have unit tests been run against this PR? (Has there also been any additional testing?)
Yes
Related Python client changes (link commit/PR here)
NA
Related documentation changes (link commit/PR here)
Other information:
Please check if the PR fulfills these requirements