question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inserting an whole number as a double results in a Int32 field of an entity

See original GitHub issue

Which service(blob, file, queue, table) does this issue concern?

table

Which version of the Azurite was used?

3.16.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

npm

What’s the Node.js version?

16.3.1

What problem was encountered?

When using EntityProperty.GeneratePropertyForDouble((double?)1.0D) the data type of the property in the table is set to Int32, and not to Double, incorrectly.

When using EntityProperty.GeneratePropertyForDouble((double?)1.1D) the data type of the property in the table is set to Double, correctly.

Steps to reproduce the issue?

If possible, please provide the debug log using the -d parameter, replacing <pathtodebuglog> with an appropriate path for your OS, or review the instructions for docker containers:

-d "<pathtodebuglog>"

Please be sure to remove any PII or sensitive information before sharing!
The debug log will log raw request headers and bodies, so that we can replay these against Azurite using REST and create tests to validate resolution.

Have you found a mitigation/solution?

No

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
edwin-hubercommented, Apr 27, 2022

I shall look to make Azurite return the point in the double value, as the SDKs are using this to determine entity value type. That should resolve this issue.

1reaction
edwin-hubercommented, Apr 27, 2022

Hi, Thanks for sharing the debug log. I tested this morning against the current main branch of Azurite on Windows 11 with nodejs version 14.15.4. I do not see this behavior in storage explorer. In your debug log I see that the request is for minimal metadata, using the Cosmos Table SDK: RequestHeaders:{"host":"127.0.0.1:10002","accept-charset":"UTF-8","maxdataserviceversion":"3.0;NetFx","accept":"application/json; odata=minimalmetadata","dataserviceversion":"3.0;","x-ms-client-request-id":"2cbbab00-06db-455d-8e9e-bd85866bfce8","user-agent":"Azure-Cosmos-Table/1.0.8 (.NET CLR 6.0.3; Win32NT 10.0.22000.0)"

which means that the data-type for the double value is not returned, and we return without the ‘.0’ suffix. {\"odata.metadata\":\"http://127.0.0.1:10002/devstoreaccount1/$metadata#TestTool/@Element\",\"odata.etag\":\"W/\\\"datetime'2022-03-18T07%3A47%3A59.9140000Z'\\\"\",\"PartitionKey\":\"GenericReadWriteTest\",\"RowKey\":\"a18e5cb5-d0f6-4e47-a1a8-7fb6ff5e4609\",\"TestDouble\":42,\"Timestamp@odata.type\":\"Edm.DateTime\",\"Timestamp\":\"2022-03-18T07:47:59.9140000Z\"}

Read more comments on GitHub >

github_iconTop Results From Across the Web

NET EF - dividing a byte field results an int instead of double
Is there a way to force EF to convert the result somehow to double ? Adding a ( double ) cast before the...
Read more >
Int32 Struct (System) | Microsoft Learn
Represents a 32-bit signed integer. ... If the numeric value is a Single, Double, or Decimal value that includes a fractional component, the...
Read more >
A Tutorial on Data Representation - Integers, Floating-point ...
Computers use binary (base 2) number system, as they are made from binary digital components (known as transistors) operating in two states -...
Read more >
C# Decimal vs Double and Other Tips About Number Types
Learn about precision vs accuracy and when to use int, double, ... Int32 (aka int): A signed integer with 32 bits (4 bytes)...
Read more >
Documentation: 8.1: Data Types - PostgreSQL
Users may add new types to PostgreSQL using the CREATE TYPE command. ... The types smallint, integer, and bigint store whole numbers, that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found