airbytehq / airbytehq/airbyte-protocol

[java] loss of precision with `number` fields

オープン
#89 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
13
フォーク
13
PR マージ指標
30日以内にマージされた PR はありません

説明

We should set `useBigDecimals = true` in the jsonSchema2Pojo gradle config.

Presently, the protocol defines fields which are oddly of type `number`:
- `emitted_at` in TRACE and CONTROL messages
- `record_count`

The `emitted_at` field is always a millisecond epoch timestamp. In Java, the jackson library will always serialize `double` and `float` values using scientific notation, which can cause loss of precision in the least significant digits, yet these are precisely those which are interesting to the user here.

The `record_count` was deliberately picked to be a `double` though the reason isn't immediately obvious, a `long` should be quite sufficient.

In any case, the values are always integers and not terribly huge ones either, they should be perfectly safe to represent using `BigDecimal`.

This change is not backward-compatible, but perhaps that's not that big of a deal? I don't know.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。