avro
avro copied to clipboard
AVRO-3224: Fix ReflectDatumReader.readField when using ReflectData.AllowNull with two conversions that convert to the same avro logical type
Make sure you have checked all steps below.
Jira
- [x] My PR addresses the following Avro Jira issues and references them in the PR title. For example, "AVRO-1234: My Avro PR"
- https://issues.apache.org/jira/browse/AVRO-3224
Tests
- [x] My PR adds the following unit tests:
- TestReflectLogicalTypes.testReflectedSchemaWithMultipleDateConversions
- TestReflectLogicalTypes.testReflectedSchemaWithMultipleDateConversions
Commits
- [x] My commits all reference Jira issues in their subject lines. In addition, my commits follow the guidelines from "How to write a good git commit message":
- Subject is separated from body by a blank line
- Subject is limited to 50 characters (not including Jira issue reference)
- Subject does not end with a period
- Subject uses the imperative mood ("add", not "adding")
- Body wraps at 72 characters
- Body explains "what" and "why", not "how"
Documentation
- No new functionality
@opwvhk
I changed the code a bit so now it's able to handle array of unions as well. Also the logic of apply logical conversions are now removed into one place in ReflectDatumReader.readAndConvert. Could you help review again? Thank you
Looks a lot better now! Thank you. I've left a few minor remarks which I think would make it even better, but other than that it looks good to me.
I've changed the code according to the remarks. Thank you for the review!