microsoft / microsoft/multiclouddb-sdk-for-java

[BUG] Preserve DynamoDB N and NS numeric fidelity during decoding

Open
#110 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug java
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

  1. Store an N value with more precision than binary64 can represent, such as a 38-digit DynamoDB decimal.
  2. Store a valid DynamoDB integral value outside the Java long range.
  3. Read the item or decode the same values through an NS attribute.
  4. 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

  • N and every member of NS decode without binary64 precision loss.
  • Valid DynamoDB integers outside the Java long range 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.