You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/04/18 14:34:58 UTC

[GitHub] [pulsar] codelipenghui commented on a diff in pull request #15153: Pulsar SQL support for Decimal data type

codelipenghui commented on code in PR #15153:
URL: https://github.com/apache/pulsar/pull/15153#discussion_r852159688


##########
pulsar-sql/presto-pulsar/src/main/java/org/apache/pulsar/sql/presto/decoder/avro/PulsarAvroColumnDecoder.java:
##########
@@ -205,6 +207,13 @@ public long getLong() {
                 return floatToIntBits((Float) value);
             }
 
+            if (columnType instanceof DecimalType) {
+                ByteBuffer buffer = (ByteBuffer) value;
+                byte[] bytes = new byte[buffer.remaining()];
+                buffer.get(bytes);
+                return new BigInteger(bytes).longValue();

Review Comment:
   We might get a negative value If the value of Decimal is over the max value of long



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

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