You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "Sean Busbey (JIRA)" <ji...@apache.org> on 2016/06/13 15:56:20 UTC

[jira] [Comment Edited] (AVRO-1847) IDL compiler uses ByteBuffer for decimal type even if logical type is supported

    [ https://issues.apache.org/jira/browse/AVRO-1847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15327642#comment-15327642 ] 

Sean Busbey edited comment on AVRO-1847 at 6/13/16 3:55 PM:
------------------------------------------------------------


{code}
diff --git a/lang/java/avro/src/main/java/org/apache/avro/Conversions.java b/lang/java/avro/src/main/java/org/apache/avro/Conversions.java
index 14408d9..62b9b5e 100644
...
+  public static Object convertToLogicalType(Object datum, Schema schema, LogicalType type,
+                                            Conversion<?> conversion) {
+    try {
...
+
+  public static <T> Object convertToRawType(Schema schema, LogicalType logicalType,
+                                            Conversion<T> conversion, Object datum) {
+    if (conversion == null) {
+      return datum;
+    }
{code}

Why do we do a null check that turns this into a no-op in only one direction of the conversion? Seems like either both should be IllegalArgumentException or if we want the passthrough behavior both ought to do it.


was (Author: busbey):
{code}
+  public static Object convertToLogicalType(Object datum, Schema schema, LogicalType type,
+                                            Conversion<?> conversion) {
+    try {
...
+
+  public static <T> Object convertToRawType(Schema schema, LogicalType logicalType,
+                                            Conversion<T> conversion, Object datum) {
+    if (conversion == null) {
+      return datum;
+    }
{code}

Why do we do a null check that turns this into a no-op in only one direction of the conversion? Seems like either both should be IllegalArgumentException or if we want the passthrough behavior both ought to do it.

> IDL compiler uses ByteBuffer for decimal type even if logical type is supported 
> --------------------------------------------------------------------------------
>
>                 Key: AVRO-1847
>                 URL: https://issues.apache.org/jira/browse/AVRO-1847
>             Project: Avro
>          Issue Type: Bug
>          Components: java
>    Affects Versions: 1.8.0
>            Reporter: Yibing Shi
>         Attachments: AVRO-1847.1.patch, AVRO-1847.2.patch, AVRO-1847.3.patch, AVRO-1847.4.patch
>
>
> Version 1.8.0 has added the support of logical types. A conversion class (Conversions.DecimalConversion) has also been added for decimal type. However, the IDL compiler still uses ByteBuffer for decimal types, which is not the same behaviour as data, time or timestamp type (added in AVRO-1684). 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)