microsoft / microsoft/multiclouddb-sdk-for-java
[BUG] Preserve DynamoDB N and NS numeric fidelity during decoding
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7
- Forks
- 7
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 1
Description
Bug description
DynamoItemMapper currently decodes DynamoDB N and NS strings through Java primitive parsers. Decimal values are converted through Double.parseDouble(...), which can silently lose DynamoDB's native decimal precision, and integral values outside the long range cannot be represented by the current fallback.
The behavior affects read/query/update result fidelity and predates #105, so it should be fixed independently of partial update.
Provider
- Azure Cosmos DB
- Amazon DynamoDB
- Google Cloud Spanner
- Not provider-specific
Reproduction steps
- Store an
Nvalue with more precision than binary64 can represent, such as a 38-digit DynamoDB decimal. - Store a valid DynamoDB integral value outside the Java
longrange. - Read the item or decode the same values through an
NSattribute. - Compare the returned Jackson nodes with the native numeric strings.
Expected behaviour
The mapper preserves native DynamoDB numeric fidelity (for example with DecimalNode/BigIntegerNode) until the portable API applies its explicitly documented numeric contract.
Actual behaviour
Decimal values can be silently rounded to binary64, and large integral values can fail during primitive parsing.
Acceptance criteria
-
Nand every member ofNSdecode without binary64 precision loss. - Valid DynamoDB integers outside the Java
longrange are handled deterministically. - Encoding the decoded node back to DynamoDB preserves the numeric value.
- Read, query, and partial-update round-trip tests cover high-precision decimals, exponent forms, large positive/negative integers, and number sets.
- Integration with the future portable numeric boundary is explicit rather than an accidental mapper conversion.
Additional context
Related umbrella issues: #37 and #64.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the DynamoItemMapper implementation and the existing read, query, update, and number-set round-trip tests. Start by tracing how N and NS strings become Jackson nodes, then verify high-precision decimals, exponent forms, and out-of-range integers preserve their numeric values through decoding and re-encoding. The portable numeric boundary should be explicit, as required by the acceptance criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100