Skip to content
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

Class-typed fields are required when inserting a new document #1851

Open
3 of 6 tasks
oytuntez opened this issue Feb 8, 2024 · 3 comments
Open
3 of 6 tasks

Class-typed fields are required when inserting a new document #1851

oytuntez opened this issue Feb 8, 2024 · 3 comments

Comments

@oytuntez
Copy link

oytuntez commented Feb 8, 2024

Initial Checks

  • I have read and followed the docs and still think this is a bug

Description

I have this dataclass:

class QuoteFile(BaseDoc):
    quote_file_id: int = None
    extracted_data: Optional[ExtractedDocumentData] = None

When indexing a new document, extracted_data is always required no matter what I do (type it with Optional etc). This is especially caused by BaseDocIndex._get_values_by_column().

I have finally forked docarray, will send a PR for various minor fixes like this one:

image

You can see my changes here, the highlighted line returns None when the field object is optional and not given for a new document during indexing.

Example Code

No response

Python, DocArray & OS Version

Python 3.8.12
docarray==0.40.0

Affected Components

@oytuntez oytuntez changed the title Typed fields are required when inserting a new document Class-typed fields are required when inserting a new document Feb 8, 2024
@JoanFM
Copy link
Member

JoanFM commented Feb 8, 2024

Hey @oytuntez ,

Can you please provide a code snippet of the code that showcases the problem, this turns out to be extremely helpful

@JoanFM
Copy link
Member

JoanFM commented Feb 8, 2024

Thanks a lot, we are looking forward the PRs from you.

@ai-naymul
Copy link
Contributor

Hey @oytuntez ,

Can you please provide a code snippet of the code that showcases the problem, this turns out to be extremely helpful

Hi @oytuntez,

Do you have a reproducible code to find out the main problem, that would be great to solve it asap ;)

Looking forward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants