avro-util icon indicating copy to clipboard operation
avro-util copied to clipboard

[fast-avro][deserializer] Populate methods always with 'customization' argument

Open krisso-rtb opened this issue 9 months ago • 2 comments

Populate methods now always have 'customization' argument because deserialize-method(s) of nested records may generate another populate methods that require 'customization' (at least for compilation purposes).

This may happen when record is deserialized with schema having less fields (usually: older schema) AND populate_...() helper method is generated on a field for which recordAction.getShouldRead() == false, so a bit of bad-luck is also needed.

In the added unit-test, without fix the methods chain is:

deserialize(RecordWithOneNullableText reuse, Decoder decoder, DatumReaderCustomization customization)
--> deserializeRecordWithOneNullableText0((reuse), (decoder), (customization))
 --> populate_RecordWithOneNullableTextAndDeeplyNestedRecord0((RecordWithOneNullableTextAndDeeplyNestedRecord), (customization), (decoder));
  --> deserializeNestedRecord0(null, (decoder), (customization));
   --> populate_NestedRecord0((decoder));
    --> deserializeDeeplyNestedRecord0(null, (decoder), (customization)); // ! unknown 'customization' variable

krisso-rtb avatar Apr 29 '24 22:04 krisso-rtb

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 46.21%. Comparing base (2fd93ac) to head (ff2c378). Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #557      +/-   ##
============================================
- Coverage     46.24%   46.21%   -0.04%     
+ Complexity     4619     4591      -28     
============================================
  Files           412      410       -2     
  Lines         28679    28610      -69     
  Branches       4686     4677       -9     
============================================
- Hits          13262    13221      -41     
+ Misses        13834    13809      -25     
+ Partials       1583     1580       -3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Apr 30 '24 07:04 codecov-commenter

Hi @radai-rosenblatt , @FelixGV , @gaojieliu Would you be able to take a look at this fix?

krisso-rtb avatar May 06 '24 09:05 krisso-rtb

Looks good to me and I am going to merge it and cut a new release. Thanks for the fix!

gaojieliu avatar May 06 '24 21:05 gaojieliu

New release is out: https://github.com/linkedin/avro-util/releases/tag/0.4.17

gaojieliu avatar May 06 '24 22:05 gaojieliu

Thank you @gaojieliu !

krisso-rtb avatar May 07 '24 17:05 krisso-rtb