jecsand838 commented on code in PR #9291:
URL: https://github.com/apache/arrow-rs/pull/9291#discussion_r2806586803
##########
arrow-avro/src/codec.rs:
##########
@@ -356,6 +356,56 @@ impl AvroDataType {
| Codec::DurationMicros
| Codec::DurationMillis
| Codec::DurationSeconds =>
AvroLiteral::Long(parse_json_i64(default_json, "long")?),
+ #[cfg(feature = "avro_custom_types")]
+ Codec::Int8 | Codec::Int16 => {
+ let i = parse_json_i64(default_json, "int")?;
+ if i < i32::MIN as i64 || i > i32::MAX as i64 {
Review Comment:
Good catch! While Avro’s primitive int is defined as a 32-bit signed
integer, the `avro_custom_types` Int8/Int16 (and UInt8/UInt16) are narrower
Arrow types, so the default literal must be validated against the target Arrow
range, not just `i32`. I pushed up changes to fix this for `Int8`, `Int16`,
`UInt8`, and `UInt16`.
Thank you again for catching this!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]