You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (Jira)" <ji...@apache.org> on 2020/05/20 14:25:00 UTC
[jira] [Closed] (FLINK-16922) DecimalData.toUnscaledBytes should be
consistent with BigDecimla.unscaledValue.toByteArray
[ https://issues.apache.org/jira/browse/FLINK-16922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jark Wu closed FLINK-16922.
---------------------------
Resolution: Fixed
master (1.12.0): 34671add8a435ee4431f4c1c4da37a8e078b7a8a
1.11.0: f7356560145f2bb862d1608264de3cf476f4abba
> DecimalData.toUnscaledBytes should be consistent with BigDecimla.unscaledValue.toByteArray
> ------------------------------------------------------------------------------------------
>
> Key: FLINK-16922
> URL: https://issues.apache.org/jira/browse/FLINK-16922
> Project: Flink
> Issue Type: Bug
> Components: Table SQL / Runtime
> Reporter: Jingsong Lee
> Assignee: Jark Wu
> Priority: Critical
> Labels: pull-request-available
> Fix For: 1.11.0
>
>
> In Decimal:
> {code:java}
> public byte[] toUnscaledBytes() {
> if (!isCompact()) {
> return toBigDecimal().unscaledValue().toByteArray();
> }
> // big endian; consistent with BigInteger.toByteArray()
> byte[] bytes = new byte[8];
> long l = longVal;
> for (int i = 0; i < 8; i++) {
> bytes[7 - i] = (byte) l;
> l >>>= 8;
> }
> return bytes;
> }
> {code}
> When is compact, it will return fix 8 length byte array.
> This should not happen, it brings an incompatible byte array.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)