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

SQLite: use projected schema when converting records #158

Merged
merged 2 commits into from
Oct 30, 2024

Conversation

sgrebnov
Copy link
Collaborator

When the first returned row contains a NULL value, the column type is inferred as NULL, causing all subsequent rows' values in that column to be converted to NULL.

This PR addresses the issue by using the projected schema when converting records. It also avoids unnecessary conversion during the try_cast_to step for primitive types, ensuring they are converted directly to the target types.

This resolves incorrect results produced with SQLite acceleration for TPC-DS queries Q51 and Q59.

Note:

  • This PR does not change the behavior related to Decimal conversion (continue to use Float64 that then will be converted to Decimal with try_cast_to). There will be a follow up PR to improve this as well.

@sgrebnov sgrebnov changed the title SQLite: use projected schema when converting records SQLite: rely on projected schema to convert records Oct 30, 2024
@sgrebnov sgrebnov requested a review from peasee October 30, 2024 06:16
@sgrebnov sgrebnov merged commit 8bdbc94 into spiceai Oct 30, 2024
3 checks passed
@sgrebnov sgrebnov deleted the sgrebnov/sqlite-improve-records-casting branch October 30, 2024 17:28
@sgrebnov sgrebnov changed the title SQLite: rely on projected schema to convert records SQLite: use projected schema when converting records Oct 30, 2024
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.

2 participants