-
Notifications
You must be signed in to change notification settings - Fork 964
Closed
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessdynamodb-enhancedp2This is a standard priority issueThis is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 10 days.Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Description
Describe the bug
BigDecimal has different behavior between top level and nested value on handling trailing zeros
value at top level is trailing-zeros-striped, but not for nested value
Expected Behavior
BigDecimal should have the same behavior regardless the property level(top, flatten, nested,...)
Current Behavior
value at top level is trailing-zeros-striped, but not for nested value
Reproduction Steps
Sample code. (Sorry for using kotlin, but I believe it should be similar in Java)
class BigDecimalConverterTest(
private val dynamoDbClient: DynamoDbClient,
private val dynamoDbEnhancedClient: DynamoDbEnhancedClient,
) {
@DynamoDbBean
data class TestTable(
@get:DynamoDbPartitionKey
var id: String = "",
var topLvValue: BigDecimal = BigDecimal.ZERO,
var nested : NestedObject = NestedObject(),
)
@DynamoDbBean
data class NestedObject(
var nestedValue: BigDecimal = BigDecimal.ZERO,
)
private val schema by lazy { TableSchema.fromBean(TestTable::class.java) }
private val table by lazy { dynamoDbEnhancedClient.table("test_table", schema) }
@BeforeEach
fun setup() {
try {
table.deleteTable()
} catch (_: Exception) {
}
table.createTable()
}
@Test
fun testSave() {
val item = TestTable(
id = "id",
topLvValue = BigDecimal("1234.4670000"),
nested = NestedObject(
nestedValue = BigDecimal("1234.4670000")
)
)
table.putItem(item)
val saved = table.getItem(Key.builder().partitionValue("id").build())
Assertions.assertEquals(item, saved)
}
}
Output
org.opentest4j.AssertionFailedError:
Expected :TestTable(id=id, topLvValue=1234.4670000, nested=NestedObject(nestedValue=1234.4670000))
Actual :TestTable(id=id, topLvValue=1234.467, nested=NestedObject(nestedValue=1234.4670000))
Possible Solution
No response
Additional Information/Context
No response
AWS Java SDK version used
2.25.36
JDK version used
openjdk 21.0.2 2024-01-16 LTS OpenJDK Runtime Environment Corretto-21.0.2.13.1 (build 21.0.2+13-LTS) OpenJDK 64-Bit Server VM Corretto-21.0.2.13.1 (build 21.0.2+13-LTS, mixed mode, sharing)
Operating System and version
macOS Sônma 14.6.1
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.closed-for-stalenessdynamodb-enhancedp2This is a standard priority issueThis is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 10 days.Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.