[
https://issues.apache.org/jira/browse/FLINK-16922?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jingsong Lee updated FLINK-16922:
---------------------------------
Description:
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.
> 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
> Priority: Major
> 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)