You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "olalamichelle (via GitHub)" <gi...@apache.org> on 2023/08/30 02:07:16 UTC

[GitHub] [beam] olalamichelle commented on issue #27520: [Bug]: Avro schema support doesn't support UNION types (OneOf) for SpecificRecords

olalamichelle commented on issue #27520:
URL: https://github.com/apache/beam/issues/27520#issuecomment-1698384106

   What should the expected behavior for it though? The asvc compile just generates code to return Object for union types (https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L827). There are 3 options I could see here:
   
   1. Still error out, just return a better error message telling that Union is not supported with SpecificRecord.
   2. Use the `getClassSchema` in the generated `SpecificRecord` class. However, this could lead to inconsistent type in some cases? The asvc compiler has a setting `setEnableDecimalLogicalType` (https://github.com/apache/avro/blob/master/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java#L296) which may generate different types for DECIMAL. Using the `getClassSchema` seems unable to handle this case?
   3. Use the Row schema, which also sounds weird.
   
   So I am actually leaning towards just fail with a better error message and admit this limitation. Could anyone that is more familiar with this area comment on it?


-- 
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: github-unsubscribe@beam.apache.org

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