You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Danny Chen (Jira)" <ji...@apache.org> on 2020/05/20 09:00:00 UTC
[jira] [Updated] (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 ]
Danny Chen updated FLINK-16922:
-------------------------------
Summary: DecimalData.toUnscaledBytes should be consistent with BigDecimla.unscaledValue.toByteArray (was: Decimal.toUnscaledBytes should be consistent with BigDecimla.unscaledValue.toByteArray)
> 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
> 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)