Skip to content

Commit

Permalink
revert changes for money type that are broken by #7338
Browse files Browse the repository at this point in the history
  • Loading branch information
yurii-bidiuk committed Aug 3, 2022
1 parent 242b773 commit 3c1be9b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ private void registerMoney(final RelationalColumn field, final ConverterRegistra
return DebeziumConverterUtils.convertDefaultValue(field);
} else if (x instanceof Double) {
final BigDecimal result = BigDecimal.valueOf((Double) x);
return Double.toString(result.doubleValue());
if (result.compareTo(new BigDecimal("999999999999999")) == 1
|| result.compareTo(new BigDecimal("-999999999999999")) == -1) {
return null;
}
return result.toString();
} else {
return x.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,18 @@ protected void initTests() {
.addInsertValues(
"null",
"'999.99'", "'1,001.01'", "'-1,000'",
"'$999.99'", "'$1001.01'", "'-$1,000'",
"'$999.99'", "'$1001.01'", "'-$1,000'"
// max values for Money type: "-92233720368547758.08", "92233720368547758.07"
"'-92233720368547758.08'", "'92233720368547758.07'")
// Debezium has wrong parsing for values more than 999999999999999 and less than -999999999999999
// https://github.com/airbytehq/airbyte/issues/7338
/*"'-92233720368547758.08'", "'92233720368547758.07'"*/)
.addExpectedValues(
null,
// Double#toString method is necessary here because sometimes the output
// has unexpected decimals, e.g. Double.toString(-1000) is -1000.0
"999.99", "1001.01", Double.toString(-1000),
"999.99", "1001.01", Double.toString(-1000),
Double.toString(-92233720368547758.08), Double.toString(92233720368547758.07))
"999.99", "1001.01", Double.toString(-1000)
/*"-92233720368547758.08", "92233720368547758.07"*/)
.build());

// Blocked by https://github.com/airbytehq/airbyte/issues/8902
Expand Down

0 comments on commit 3c1be9b

Please sign in to comment.