You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/09/22 18:51:56 UTC

[GitHub] [kafka] avocader opened a new pull request #9320: KAFKA-10439: Connect's Values to parse BigInteger as Decimal with zero scale.

avocader opened a new pull request #9320:
URL: https://github.com/apache/kafka/pull/9320


   The `org.apache.kafka.connect.data.Values#parse` method parses integers, which are larger than `Long.MAX_VALUE` as `double` with `Schema.FLOAT64_SCHEMA`.
   
   That means we are losing precision for these larger integers.
   
   For example:
   ```
   SchemaAndValue schemaAndValue = Values.parseString("9223372036854775808");
   ```
   returns:
   ```
   SchemaAndValue{schema=Schema{FLOAT64}, value=9.223372036854776E18}
   ```
   Also, this method parses values, that can be parsed as `FLOAT32` to `FLOAT64`.
   
   This PR changes parsing logic, to use `FLOAT32`/`FLOAT64` for numbers that don't have and fraction part(`decimal.scale()!=0`) only, and use an arbitrary-precision `org.apache.kafka.connect.data.Decimal` otherwise.
   Also, it updates the method to parse numbers, that can be represented as `float` to `FLOAT64`.
   
   Added unit tests, that cover parsing `BigInteger`, `Byte`, `Short`, `Integer`, `Long`, `Float`, `Double` types.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [kafka] kkonstantine merged pull request #9320: KAFKA-10439: Connect's Values to parse BigInteger as Decimal with zero scale.

Posted by GitBox <gi...@apache.org>.
kkonstantine merged pull request #9320:
URL: https://github.com/apache/kafka/pull/9320


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org