Skip to content

Commit

Permalink
Checkpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Jun 17, 2024
1 parent 815466d commit b6ebed4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/debezium/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b6ebed4

Please sign in to comment.