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

Push empty vec on ArrowAssoc when Option is None to fix Postgres _varchar can panic on Option.unwrap #490

Merged
merged 3 commits into from
Apr 18, 2023

Conversation

auyer
Copy link
Contributor

@auyer auyer commented Apr 18, 2023

Reading a varchar array can return error thread '<unnamed>' panicked at 'called Option::unwrap()on aNone value'
I was not able to figure out what row in my database led to this error because its a large base, and this PR fixes the issue already. But it would be interesting to figure this out and add it as a test condition.

This PR also adds unwrap on try_push for Vec and Vec<Option>.

If try_push fails, the resulting Chunks will have wrong size.

_read_sql(
RuntimeError: Invalid argument error: Chunk require all its arrays to have an equal number of rows

I believe these failures should not be dealt with .unwrap(), but at this point, propagating errors will be a big refactor for ConnectorX.

Fixes #489

If it fails, the resulting Chunks will have wrong size

With unwrap the failure wont be so silent.

Failure without unwrap:
_read_sql(
RuntimeError: Invalid argument error: Chunk require all its arrays to have an equal number of rows
@wangxiaoying
Copy link
Contributor

Thanks @auyer , this fix looks good to me. I will try to release an alpha version for test today.

@wangxiaoying wangxiaoying merged commit 79d6cb7 into sfu-db:main Apr 18, 2023
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

Successfully merging this pull request may close these issues.

Postgres _varchar can panic on Option.unwrap
2 participants