feat: nested attribute access in find()#1176
Merged
Merged
Conversation
47 tasks
samsja
reviewed
Feb 27, 2023
| emb = embedding_type._docarray_stack(emb_list) | ||
| elif isinstance(data, DocumentArrayStacked): | ||
| emb = getattr(data, embedding_field) | ||
| emb = next(AnyDocumentArray._traverse(data, embedding_field)) |
Member
There was a problem hiding this comment.
not sure to understand why it is next here
Contributor
Author
There was a problem hiding this comment.
For DocumentArray stacked, the _traverse will yield one stacked tensor, by calling next() on it, I want to get that one tensor. I think this would be the same as calling list(AnyDocumentArray._traverse(data, embedding_field))[0].
JohannesMessner
requested changes
Feb 27, 2023
|
|
||
| def _get_field_type_by_access_path( | ||
| doc_type: Type['BaseDocument'], access_path: str | ||
| ) -> Any: |
added 12 commits
February 27, 2023 14:45
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
68af091 to
8400ed4
Compare
|
📝 Docs are deployed on https://ft-feat-find-nested-access--jina-docs.netlify.app 🎉 |
samsja
approved these changes
Feb 27, 2023
JohannesMessner
approved these changes
Feb 27, 2023
AsRaNi1
pushed a commit
to AsRaNi1/docarray
that referenced
this pull request
Feb 28, 2023
* test: add test for find on nested attribute Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * test: add test for nested attr in stacked da Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: nested access Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: mypy Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: field type by access path for da Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: clean up Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: move get field type by access path Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: imports Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestion and fix import Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestion from code review Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestion from code review Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestions Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> --------- Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> Signed-off-by: Arnav Zutshi <arnzut1324@gmail.com>
Jackmin801
pushed a commit
that referenced
this pull request
Mar 2, 2023
* test: add test for find on nested attribute Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * test: add test for nested attr in stacked da Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: nested access Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: mypy Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: field type by access path for da Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: clean up Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: move get field type by access path Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: imports Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestion and fix import Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestion from code review Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestion from code review Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestions Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> --------- Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Jackmin801
pushed a commit
that referenced
this pull request
Mar 2, 2023
* test: add test for find on nested attribute Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * test: add test for nested attr in stacked da Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: nested access Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: mypy Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: field type by access path for da Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: clean up Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: move get field type by access path Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: imports Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestion and fix import Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestion from code review Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestion from code review Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> * fix: apply suggestions Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai> --------- Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Goals:
allow nested attribute access in
find(), which currently isn't supported yet. Nested access will be possible by '__'-separated access paths.Example: