[
https://issues.apache.org/jira/browse/AVRO-3585?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17570766#comment-17570766
]
ASF subversion and git services commented on AVRO-3585:
-------------------------------------------------------
Commit 945820a9ce5a4ad67fb9a9cdacbddbaacfd2e5db in avro's branch
refs/heads/master from Rik Heijdens
[ https://gitbox.apache.org/repos/asf?p=avro.git;h=945820a9c ]
AVRO-3585: Add support for encoding Value::String as Schema::Uuid (#1778)
* AVRO-3585: Add test-case to confirm UUID handling
Added a test-case to confirm encoding UUIDs that are provided as
Value::String works as expected.
* AVRO-3585: Add Uuid as a supported encoding
Added Schema::Uuid as supported encoding for Value::String.
In some cases Uuids may be presented as a Value::String to the Avro
encoder, previously, the encoder would reject these values. This has
been fixed by this commit.
* AVRO-3585: Simplify match statement
Removed a duplicate branch for matching Schema::Uuid by collapsing
it into the branch for matching Schema::String.
Co-authored-by: gabriel <[email protected]>
> Unable to encode Value::String as Schema::UUID
> ----------------------------------------------
>
> Key: AVRO-3585
> URL: https://issues.apache.org/jira/browse/AVRO-3585
> Project: Apache Avro
> Issue Type: Bug
> Components: rust
> Reporter: Rik Heijdens
> Priority: Blocker
> Labels: pull-request-available
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Currently, `apache_avro::encode::encode()` fails to encode a Value::String as
> UUID. This failure can be reproduced using the following minimal test-case:
>
> {code:java}
> #[test]
> fn test_encode_uuid() {
> let value =
> Value::String(String::from("00000000-0000-0000-0000-000000000000"));
> let schema = Schema::Uuid;
> let mut buffer = Vec::new();
> let encoded = encode(&value, &schema, &mut buffer);
> assert!(encoded.is_ok());
> } {code}
>
>
> I believe it should be possible to encode UUIDs in this manner, and support
> can be trivially added by extending the match statement in
> `apache_avro::encode::encode_internal`.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)