-
-
Notifications
You must be signed in to change notification settings - Fork 136
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
Deserialization of "empty" Records as root values fails #177
Conversation
Quick question here: is this related to how Apache Avro library generates schema, or can this be easily replicated with textual schema and/or Avro module's schema generator? Just figuring out where to add the test: if it's related to apache lib, interop is fine; but if not I try to keep depenencies to it to minimum. I will try to help with this issue over the weekend: thank you for all your work on Avro module & apologies for limited time I have to spend to help keep you unblocked. |
I don't believe that is related to schema generation, but rather to the serialization logic that expects a non-empty list of field, mainly because I’m providing the schema in the test. Thank you for your support. I'm glad to contribute to a library that helps us that much. |
@marcospassos Ok so the test can be simplified to use (f.ex) embedded schema it sounds like. |
Did not have time to dig into this today: it's at top of my list and (aside from adding comments which I prioritize high to try to help everyone), and should be able to at least get test added, have a look at exception tomorrow, |
@marcospasson Ok yes, I can see the problem. Will see if I can easily fix this corner case. |
Hmmh. So, end-of-input detection by reader notices we are out of content (which is true), but reader probably would need to synthesize START_OBJECT/END_OBJECT for special case of empty Object(s). Possibly/probably only affects root values, not nested ones. |
This may be difficult thing to fix. The problem is that at root level decision needs to be made regarding whether more content is available or not, and that is determined by checking if more content is available. In this case there isn't, and usually that signals end-of-content. But since "empty" Record takes no space, in this instance expectation is that handling should sort of materialize empty structure (START_OBJECT, END_OBJECT) out of no content. So: the idea would be to detect the case of Record with no fields being read, and if so, avoid indicating end-of-content. With that |
And just to test above: if I pass |
Hmmm, got it. How about checking the schema for emptiness? |
That is sort of what I ended up doing, having a look at fields found, if any. I suspect some edges might still cause problems (maybe for "constant" values), but this case works now. Well, it does for 2.10; |
Thank you! |
Np -- thank you for reporting it. Let me know if you find other edge cases. |
@cowtowncoder Could you please give me some guidance on how to fix this issue? I'd like to fix it in time for 2.10.
The unit test spots the issue: empty records fail on deserialization.