Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codegen : Custom decode method broken into subMethods #507

Merged
merged 5 commits into from
Aug 17, 2023

Conversation

li-ukumar
Copy link
Member

@li-ukumar li-ukumar commented Aug 16, 2023

What

This change will break up generated customDecode method into small subMethods while keeping the functionality consistent.

Why

Since generated customDecode method can be large for larger schemas, it could exceed size limit 64k. Splitting method into smaller subMethods avoids it.

Issue: #257

Test

Added UT with a 1000 field record round trip ser/deserialization.
Errors out on current master
Screenshot 2023-08-16 at 5 00 10 PM

"this." + replaceSingleDollarSignWithDouble(escapedFieldName), StringUtils.EMPTY_STRING));

while (fieldCounter < recordSchema.getFields().size()) {
String chunkMethodName = "customDecodeIfChunk" + chunkCounter;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - why call the method "customDecodeIfChunk0()" ?
as oposed to customDecodeChunk0() ? what does the "if" stand for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2023-08-16 at 4 35 08 PM

The generated method has if and else chunks.

@codecov-commenter
Copy link

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.08% 🎉

Comparison is base (b96177e) 45.75% compared to head (c30f0d7) 45.83%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #507      +/-   ##
============================================
+ Coverage     45.75%   45.83%   +0.08%     
- Complexity     4432     4440       +8     
============================================
  Files           398      398              
  Lines         28015    28041      +26     
  Branches       4619     4621       +2     
============================================
+ Hits          12817    12852      +35     
+ Misses        13640    13635       -5     
+ Partials       1558     1554       -4     
Files Changed Coverage Δ
...vroutil1/codegen/SpecificRecordClassGenerator.java 87.80% <100.00%> (+0.25%) ⬆️
...avroutil1/codegen/SpecificRecordGeneratorUtil.java 85.94% <100.00%> (+0.07%) ⬆️

... and 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@li-ukumar li-ukumar merged commit 2019012 into master Aug 17, 2023
2 checks passed
flowenol pushed a commit to RTBHOUSE/avro-util that referenced this pull request Aug 23, 2023
* breaking custom decode into sub methods

* updated block size of customDecode blocks to 25

* 1000 field record round-trip ser/deser UT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants