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

[NR-302034] fix: handle DECIMAL values in custom queries #173

Merged
merged 7 commits into from
Sep 16, 2024

Conversation

sigilioso
Copy link
Contributor

This PR updates the function handling custom queries in order that it can parse DECIMAL values.

The previous implementation was scanning all the values into interface{} values, which means that the driver performs no conversion, and later it was converting all the values to string, to finally try to convert to Float64 for the corresponding types. This wasn't working well because the driver represents DECIMAL values as uint8[] and the corresponding conversion to string was an array of bytes. We have updated it to directly scan the values into the string type (which tells the driver to perform the corresponding conversion) and later, we keep converting the strings to numbers only when needed.

The PR also includes a small refactor of the function handling custom queries and some unit-test to try to assure its behavior doesn't change.

@sigilioso sigilioso requested a review from a team September 12, 2024 10:26
go.mod Show resolved Hide resolved
@sigilioso sigilioso force-pushed the NR-302034-fix-decimal-values-custom-queries branch 2 times, most recently from 4e86eab to 150264f Compare September 12, 2024 14:57
@sigilioso sigilioso force-pushed the NR-302034-fix-decimal-values-custom-queries branch from 150264f to 64016f4 Compare September 12, 2024 15:02
Copy link
Member

@paologallinaharbur paologallinaharbur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way easier to follow now!

@sigilioso sigilioso merged commit 7e7d405 into master Sep 16, 2024
17 checks passed
@sigilioso sigilioso deleted the NR-302034-fix-decimal-values-custom-queries branch September 16, 2024 10:06
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