Uploaded image for project: 'Apache Avro'
  1. Apache Avro
  2. AVRO-3585

Unable to encode Value::String as Schema::UUID

    XMLWordPrintableJSON

Details

    Description

      Currently, `apache_avro::encode::encode()` fails to encode a Value::String as UUID. This failure can be reproduced using the following minimal test-case:

       

          #[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());
          } 

       

       

      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`.

      Attachments

        Issue Links

          Activity

            People

              mgrigorov Martin Tzvetanov Grigorov
              rheijdens Rik Heijdens
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m