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/04/21 08:31:00 UTC
[jira] [Assigned] (FLINK-16922) Decimal.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 reassigned FLINK-16922:
-------------------------------
Assignee: Jark Wu
> Decimal.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
> 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)