You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by "tjwp (via GitHub)" <gi...@apache.org> on 2023/06/13 18:38:54 UTC

[GitHub] [avro] tjwp commented on a diff in pull request #2277: AVRO-3775: [ruby] fix decoded default value of decimal logical type

tjwp commented on code in PR #2277:
URL: https://github.com/apache/avro/pull/2277#discussion_r1228552018


##########
lang/ruby/lib/avro/io.rb:
##########
@@ -397,7 +397,12 @@ def read_default_value(field_schema, default_value)
           return Integer(default_value)
         when :float, :double
           return Float(default_value)
-        when :boolean, :enum, :fixed, :string, :bytes
+        when :boolean, :enum, :fixed, :string
+          return default_value
+        when :bytes
+          if field_schema.logical_type == Schema::DECIMAL_LOGICAL_TYPE
+            return field_schema.type_adapter.decode(default_value)

Review Comment:
   I wonder if we should apply `type_adapter.decode` to all values currently returned from this method (similar to the `read_data` method). There are logical types for `int` and `long` that would benefit from this fix too.



-- 
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: issues-unsubscribe@avro.apache.org

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