tjwp commented on a change in pull request #918:
URL: https://github.com/apache/avro/pull/918#discussion_r503864105



##########
File path: lang/ruby/lib/avro/logical_types.rb
##########
@@ -81,10 +284,11 @@ def self.decode(datum)
       },
     }.freeze
 
-    def self.type_adapter(type, logical_type)
+    def self.type_adapter(type, logical_type, schema = nil)
       return unless logical_type
 
-      TYPES.fetch(type, {}.freeze).fetch(logical_type, Identity)
+      adapter = TYPES.fetch(type, {}.freeze).fetch(logical_type, Identity)
+      adapter.is_a?(Class) ? adapter.new(schema) : adapter

Review comment:
       Checking if the adapter is a Class still do not seem like a great 
interface to me. For both modules and classes, you could define a static, class 
method for `.requires_schema?`. But the implementation here may be affected by 
how the validation of the decimal logical type is handled.




----------------------------------------------------------------
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:
[email protected]


Reply via email to