mbrobbel commented on code in PR #7889: URL: https://github.com/apache/arrow-rs/pull/7889#discussion_r2199862261
########## arrow-avro/src/reader/record.rs: ########## @@ -273,6 +276,9 @@ impl Decoder { Self::Binary(offsets, _) | Self::String(offsets, _) | Self::StringView(offsets, _) => { offsets.push_length(0); } + Self::Uuid(v) => { + v.push(0); Review Comment: I think we should push 16 zero bytes here: ```suggestion v.extend([0; 16]); ``` ########## arrow-avro/src/reader/record.rs: ########## @@ -611,6 +619,46 @@ fn sign_extend_to<const N: usize>(raw: &[u8]) -> Result<[u8; N], ArrowError> { Ok(arr) } +#[inline] +fn hex_char_to_u8(c: u8) -> Result<u8, ArrowError> { + match c { + b'0'..=b'9' => Ok(c - b'0'), + b'a'..=b'f' => Ok(c - b'a' + 10), + b'A'..=b'F' => Ok(c - b'A' + 10), + _ => Err(ArrowError::ParseError(format!( + "Invalid hex character '{c}' in UUID string", + ))), + } +} + +#[inline] +fn parse_uuid_bytes(s_bytes: &[u8]) -> Result<[u8; 16], ArrowError> { Review Comment: I would suggest using https://docs.rs/uuid/latest/uuid/struct.Uuid.html#method.try_parse ########## arrow-avro/src/codec.rs: ########## @@ -201,7 +201,7 @@ pub enum Codec { /// - `scale` (`Option<usize>`): Number of fractional digits. /// - `fixed_size` (`Option<usize>`): Size in bytes if backed by a `fixed` type, otherwise `None`. Decimal(usize, Option<usize>, Option<usize>), - /// Represents Avro Uuid type, a FixedSizeBinary with a length of 16 + /// Represents Avro Uuid type, a FixedSizeBinary with a length of 16. Review Comment: Maybe you can change `AvroDataType::field_with_name` to match on the `Codec` and for `Codec::Uuid` add the [`Uuid`](https://docs.rs/arrow-schema/latest/arrow_schema/extension/struct.Uuid.html) canonical extension type via [`Field::with_extension_type`](https://docs.rs/arrow-schema/latest/arrow_schema/struct.Field.html#method.with_extension_type)? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org