-
-
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
Invalid Avro file produced using SequenceWriter #339
Comments
I think the problem may be Avro oddity where in data encoding as File requires use of header which is otherwise not used (or allowed) at all. |
Ah okay...given everything I found I thought this was well supported - especially because of this particular bit That particular feature is documented in JavaDoc and I found this as well: Lines 107 to 118 in 169d2fb
|
@willsoto Hmmh. I had actually forgotten about this being implemented. But had I read your example in detail, it would have been there. I assume you have also tried disabling that to see what difference it makes? Is there matching reader (deserialization side) setting to go with it? |
No worries! Appreciate you taking the time to help me out 😄
If I understand the question, I initially just tried the examples pretty much copy+pasted from the documentation so I didn't even know there was this
Not sure honestly. The way I've been testing is writing the file and then attempting to open it with |
Ok that makes sense. Adding example files into a (new) unit test would be nice too. One challenge wrt Avro tho is that without file header it has zero metadata to detect valid data. This is unlike almost every other format, even protobuf has type tags etc for some level of self-descriptiveness. |
I'll try and add a test case this weekend. Does the code I provided at least seem like it should work? I am curious if we can minimize the reproduction even further. |
Oh. The part that possibly (likely?) will not work is the use of |
While documentation on writing Avro to a file is sparse, I have managed to piece some stuff together but I am still getting an error.
SequenceWriter
) #35Here is some sample code:
When checking the resultant file using
avro-tools
, I get the following error:According to some searching, the
Invalid sync!
error occurs when the file hasn't been stitched together properly, but it's unclear to me what I need to do in code to get that to happen. I've looked through most of the Avro tests in this repo and I cannot find one that actually writes to a file and then de-serializes from that file.I am not sure if I have stumbled into an actual bug here or not, but I am happy to try and write a test case if this code does seem correct since that would imply it's a bug?
Thanks in advance.
Edit:
I've also tried the following:
In which case I get the following error at that line:
The text was updated successfully, but these errors were encountered: