Skip to content

Commit 30d63fb

Browse files
committed
Handling mysql decimal data types with precision 19 or higher
Signed-off-by: Divyansh Bokadia <dbokadia@amazon.com>
1 parent 7dd38f9 commit 30d63fb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/datatype/mysql/handler

data-prepper-plugins/rds-source/src/test/java/org/opensearch/dataprepper/plugins/source/rds/datatype/mysql/handler/NumericTypeHandlerTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ private static Stream<Arguments> provideNumericTypeData() {
113113

114114
// BIT tests
115115
Arguments.of(MySQLDataType.BIT, "bit_col", BitSet.valueOf(new byte[]{ 4, 3, 2, 1 }), new BigInteger("16909060")), // BitSet interprets the bytes in little-endian order
116-
Arguments.of(MySQLDataType.BIT, "bit_col", Map.of("bytes", new byte[]{ 1, 2, 3, 4 }), new BigInteger("16909060")) // Direct BigInteger interprets the bytes in big-endian order.
116+
Arguments.of(MySQLDataType.BIT, "bit_col", Map.of("bytes", new byte[]{ 1, 2, 3, 4 }), new BigInteger("16909060")), // Direct BigInteger interprets the bytes in big-endian order.
117+
118+
//DECIMAL tests represented as byte arrays
119+
Arguments.of(MySQLDataType.DECIMAL, "decimal_col", new ArrayList<>(List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)), new BigDecimal("1339673755198158349044581307228491536")),
120+
Arguments.of(MySQLDataType.DECIMAL, "decimal_col", Map.of("bytes", new byte[]{1, 2, 3, 4}), new BigDecimal("16909060")),
121+
Arguments.of(MySQLDataType.DECIMAL, "decimal_col", new byte[]{1, 35, 69, 103, -119, -85, -51, -17}, new BigDecimal("81985529216486895"))
117122
);
118123
}
119124

0 commit comments

Comments
 (0)