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

Wrong data type for doubles with integer-like values #5356

Closed
craxal opened this issue Jan 20, 2022 · 4 comments
Closed

Wrong data type for doubles with integer-like values #5356

craxal opened this issue Jan 20, 2022 · 4 comments
Assignees
Labels
⚙️ tables Related to table storage ❔ investigate We need to look into this further ✅ merged A fix for this issue has been merged
Milestone

Comments

@craxal
Copy link
Contributor

craxal commented Jan 20, 2022

If an entity in a table has a property with an integer-like double value (for example, 123.0), the value is incorrectly interpreted to be an Int32 value whenever entities are queried from the table. This includes listing tables in the explorer, export, and table copy.

This can lead to failures in table copy or import, because some integer-like double values exceed the range of Int32.

@craxal craxal self-assigned this Jan 20, 2022
@craxal craxal added this to the 1.22.2 milestone Jan 20, 2022
@craxal
Copy link
Contributor Author

craxal commented Jan 20, 2022

The root of the problem lies in the Azure client library. The service returns double values as an unannotated numeral with a decimal for doubles (such as 123.0). The client library uses the built-in JavaScript JSON parser, which eliminates the tell-tale ".0" and thus leads to an incorrect assumption that the value is an Int32, even when the value lies outside the range of an Int32 (Int64 values are sent as annotated JSON strings).

Fixing this isn't trivial, as it requires either a custom JSON parser or some pipeline policy to scan the payload before parsing. It would be easier if the service sent an annotated value instead.

See Azure/azure-sdk-for-js#19899.

@craxal craxal added the ⚙️ tables Related to table storage label Jan 20, 2022
@craxal
Copy link
Contributor Author

craxal commented Jan 21, 2022

A possible workaround is to apply a custom pipeline policy that inserts the expected data type for Double values before the response body gets parsed.

@craxal craxal modified the milestones: 1.22.2, 1.22.1 Jan 21, 2022
@MRayermannMSFT MRayermannMSFT modified the milestones: 1.22.1, 1.23.0 Jan 25, 2022
@craxal craxal added the ✅ merged A fix for this issue has been merged label Feb 7, 2022
@craxal
Copy link
Contributor Author

craxal commented Feb 15, 2022

Workaround described as above is sufficient for the time being. I'm keeping this issue open for now, as a solution from the platform or SDK is preferable.

@craxal craxal modified the milestones: 1.23.0, 1.24.0 Feb 15, 2022
@craxal craxal added the ❔ investigate We need to look into this further label Feb 15, 2022
@craxal
Copy link
Contributor Author

craxal commented Mar 4, 2022

Since this is not likely to be fixed in the library or service anytime soon, I'm going to close this issue, but I'll keep an eye on the client library issue.

@craxal craxal closed this as completed Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚙️ tables Related to table storage ❔ investigate We need to look into this further ✅ merged A fix for this issue has been merged
Projects
None yet
Development

No branches or pull requests

2 participants