-
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-3892: [Rust] Support to resolve fixed from bytes and deserialize bytes in deserialize_any #2567
Merged
Merged
AVRO-3892: [Rust] Support to resolve fixed from bytes and deserialize bytes in deserialize_any #2567
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8b331fd
support to resolve fixed from bytes
80283f4
support to deserialize bytes, fixed, decimal.
c8ad266
fix clippy
61eeaa9
AVRO-3892: Rename test method
martin-g 4d93020
AVRO-3892: [Rust] Add unit tests for deserializing &str/String from V…
martin-g 40bc2d7
add unit test for deserialize bytes from decimal and uuid
1fb832e
add more test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -266,6 +266,8 @@ impl<'a, 'de> de::Deserializer<'de> for &'a Deserializer<'de> { | |||||
Value::String(ref s) => visitor.visit_borrowed_str(s), | ||||||
Value::Uuid(uuid) => visitor.visit_str(&uuid.to_string()), | ||||||
Value::Map(ref items) => visitor.visit_map(MapDeserializer::new(items)), | ||||||
Value::Bytes(ref bytes) | Value::Fixed(_, ref bytes) => visitor.visit_bytes(bytes), | ||||||
Value::Decimal(ref d) => visitor.visit_bytes(&d.to_vec()?), | ||||||
_ => Err(de::Error::custom(format!( | ||||||
"unsupported union: {:?}", | ||||||
self.input | ||||||
|
@@ -276,6 +278,8 @@ impl<'a, 'de> de::Deserializer<'de> for &'a Deserializer<'de> { | |||||
Value::String(ref s) => visitor.visit_borrowed_str(s), | ||||||
Value::Uuid(uuid) => visitor.visit_str(&uuid.to_string()), | ||||||
Value::Map(ref items) => visitor.visit_map(MapDeserializer::new(items)), | ||||||
Value::Bytes(ref bytes) | Value::Fixed(_, ref bytes) => visitor.visit_bytes(bytes), | ||||||
Value::Decimal(ref d) => visitor.visit_bytes(&d.to_vec()?), | ||||||
value => Err(de::Error::custom(format!( | ||||||
"incorrect value of type: {:?}", | ||||||
crate::schema::SchemaKind::from(value) | ||||||
|
@@ -350,6 +354,7 @@ impl<'a, 'de> de::Deserializer<'de> for &'a Deserializer<'de> { | |||||
Value::String(ref s) => visitor.visit_bytes(s.as_bytes()), | ||||||
Value::Bytes(ref bytes) | Value::Fixed(_, ref bytes) => visitor.visit_bytes(bytes), | ||||||
Value::Uuid(ref u) => visitor.visit_bytes(u.as_bytes()), | ||||||
Value::Decimal(ref d) => visitor.visit_bytes(&d.to_vec()?), | ||||||
_ => Err(de::Error::custom(format!( | ||||||
"Expected a String|Bytes|Fixed|Uuid, but got {:?}", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
self.input | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It'd be nice to add new unit tests for the changes above.
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.
Thanks for review! I have added the test for it.