You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@avro.apache.org by GitBox <gi...@apache.org> on 2021/02/28 13:37:58 UTC
[GitHub] [avro] tjwp commented on a change in pull request #1082: AVRO-3036: add schema matching for bytes decimal logical type in Ruby
tjwp commented on a change in pull request #1082:
URL: https://github.com/apache/avro/pull/1082#discussion_r584296817
##########
File path: lang/ruby/lib/avro/schema.rb
##########
@@ -485,6 +490,19 @@ def to_avro(names=nil)
avro['scale'] = scale if scale
avro
end
+
+ def match_schema?(schema)
+ if type_sym == schema.type_sym
+ return false if logical_type != schema.logical_type
+
+ if logical_type == 'decimal'.freeze
Review comment:
Sure, I can make a change like that, but do you know if actually makes a difference since the Ruby VM will treat this frozen string like a constant, and will not allocate a new one on each invocation:
```
irb(main):001:0> def frozen_string_alloc
irb(main):002:1> "foo".freeze.object_id
irb(main):003:1> end
=> :frozen_string_alloc
irb(main):004:0> frozen_string_alloc
=> 70328047113620
irb(main):005:0> frozen_string_alloc
=> 70328047113620 # <---------------------- same object
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org