From b6ebed43487ad3e47c132d78874839158d764695 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Mon, 17 Jun 2024 12:51:34 -0700 Subject: [PATCH] Checkpoint. --- lib/debezium/decimal.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/debezium/decimal.go b/lib/debezium/decimal.go index 9cccf6bdc..81595cc65 100644 --- a/lib/debezium/decimal.go +++ b/lib/debezium/decimal.go @@ -19,7 +19,11 @@ func EncodeDecimal(value string, scale int) ([]byte, error) { bigFloatValue.Mul(bigFloatValue, scaledValue) // Extract the scaled integer value. - bigIntValue, _ := bigFloatValue.Int(nil) + bigIntValue := new(big.Int) + if _, success := bigIntValue.SetString(bigFloatValue.String(), 10); !success { + return nil, fmt.Errorf("unable to use '%s' as a floating-point number", value) + } + data := bigIntValue.Bytes() if bigIntValue.Sign() < 0 { // Convert to two's complement if the number is negative