-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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-3920: Serialize custom attribute in RecordField #2650
Conversation
Find a interesting case:
I tried this one and the symbols will not be treated as custom attributes.
cc @martin-g |
The symbols should not be stored as attributes! It is a bug! |
But avro/lang/rust/avro/src/schema.rs Line 1675 in cc9d99b
|
it seems it is parsed here - avro/lang/rust/avro/src/schema.rs Line 773 in cc9d99b
|
If we solve it like this, it means that the user should not use "symbols" as attribute names even the type is not an enum, like the following, right? 🤔
|
See the surrounding code. |
I'll be able to help more after the holidays! |
Thanks! Enjoy your holiday! |
I send a commit to fix it. But I'm not sure whether it is a good way to solve it. |
e0e26df
to
39506df
Compare
lang/rust/avro/src/schema.rs
Outdated
@@ -3305,16 +3314,16 @@ mod tests { | |||
|
|||
let schema = Schema::parse_str(raw_schema)?; | |||
assert_eq!( | |||
"abf662f831715ff78f88545a05a9262af75d6406b54e1a8a174ff1d2b75affc4", | |||
"b18ddbf029afaa876b54cb4de997506ef67e202bee13d8b54cb5698288c25318", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a regression.
According to https://avro.apache.org/docs/1.11.1/specification/#transforming-into-parsing-canonical-form we should STRIP
everything but type, name, fields, symbols, items, values, size
. I.e. the custom attributes should be stripped and the fingerprint should stay the same.
@ZENOTME I think this PR is good to go! |
I have the feeling that the way I ignored avro/lang/rust/avro/src/schema.rs Lines 6285 to 6286 in e5ca151
The test still passes because the test depends on Schema's attributes, while the custom attribute is ignored for a record field. But those should behave the same way! There is a discussion about making |
49e33e5
to
2628de4
Compare
…attribute Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
2628de4
to
e1b2f76
Compare
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
I am going to merge this PR. |
* AVRO-3920: [Rust] * serialize custom attr in record field * AVRO-3920: [Rust] Do not parse "logicalType" as a custom RecordField attribute Signed-off-by: Martin Tzvetanov Grigorov <[email protected]> (cherry picked from commit 5184f83)
Thank you, @ZENOTME ! |
Sorry for being late. Thanks for your help!
Yes, ignored logicalType here may couse unexpectation behaviour. I think keeping keeping the logicalType as a custom attribute is reasonable behaviour because it let the user customiaze their own logical type even it's not supported by RustSDK. I guess the behaviour we ignore |
OK! I'll see how to improve it! |
* AVRO-3920: [Rust] * serialize custom attr in record field * AVRO-3920: [Rust] Do not parse "logicalType" as a custom RecordField attribute Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
What is the purpose of the change
(For example: This pull request improves file read performance by buffering data, fixing AVRO-XXXX.)
support to serialize the custom attributes in RecordField ,fixing AVRO-3920
Verifying this change
(Please pick one of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Documentation