-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
AVRO-3631: SerDe support for Value::Fixed()
.
#1893
AVRO-3631: SerDe support for Value::Fixed()
.
#1893
Conversation
This test-case mainly demonstrates the issue reported in AVRO-3631. It is unclear to me whether we should actually expect the serializer to serialize to a Value::Fixed right away given that Schema information is not available at this stage.
@RikHeijdens Please 7b1cdd8 But as you explained at JIRA since there is no schema available at serialization time it is not easy to decide whether to produce |
Thanks for taking a look into this @martin-g. If I am understanding the solution correctly, we would need in addition to this change a change to rsgen-avro to store {
"type": "record",
"name": "TestStructFixedField",
"fields": [
{
"name": "field",
"type": {
"name": "field",
"type": "fixed",
"size": 6
}
}
]
} Is this being tracked in lerouxrgd/rsgen-avro#38? |
@RikHeijdens Please see 3e3f125 I want to add some more tests related to serializing |
It's great that we can store the field in the struct as an array of However, since I'm generating the example struct that I used from an Avro schema in the first place, using rsgen-avro, I believe we'd still need support in rsgen-avro to set that attribute when generating a struct from a |
Correct! I've spent more time reading serde docs and code and I think we don't really need serde_bytes. Its documentation says that it does some optimizations but actually it just delegates to So the real implementation is here - avro/lang/rust/avro/src/ser.rs Lines 176 to 178 in 77692d8
But the problem here is still the same - there is no information about the Avro Schema and we don't know whether to use Value::Bytes or Value::Fixed .
The only solution I see is to use custom |
I'm not quite sure I understand what you mean by:
The structs that I used in my examples were generated through rsgen-avro. I suppose it might not support it for |
I meant that rsgen-avro does not put And yes, since apache-avro does not provide (yet) logic to serialize |
For some reason I was not able to push to your branch, so I opened a new PR: #1900 |
What is the purpose of the change
This Pull Request adds tests that reproduces the issue reported in AVRO-3631.
I don't have a good solution for this issue yet, and by opening this as a draft PR I'm hoping we could use this PR as a discussion medium for a solution.
Verifying this change
We're adding automated tests here (that currently fail).
Documentation