jecsand838 commented on code in PR #8349:
URL: https://github.com/apache/arrow-rs/pull/8349#discussion_r2365863049


##########
arrow-avro/src/reader/record.rs:
##########
@@ -852,6 +1303,94 @@ impl Decoder {
         Ok(())
     }
 
+    fn decode_with_promotion(
+        &mut self,
+        buf: &mut AvroCursor<'_>,
+        promotion: Promotion,
+    ) -> Result<(), ArrowError> {
+        match promotion {
+            Promotion::Direct => self.decode(buf),
+            Promotion::IntToLong => match self {
+                Self::Int64(v) => {
+                    v.push(buf.get_int()? as i64);
+                    Ok(())
+                }
+                _ => Err(ArrowError::ParseError(
+                    "Promotion Int->Long target mismatch".into(),
+                )),
+            },
+            Promotion::IntToFloat => match self {
+                Self::Float32(v) => {
+                    v.push(buf.get_int()? as f32);
+                    Ok(())
+                }
+                _ => Err(ArrowError::ParseError(
+                    "Promotion Int->Float target mismatch".into(),
+                )),
+            },
+            Promotion::IntToDouble => match self {
+                Self::Float64(v) => {
+                    v.push(buf.get_int()? as f64);
+                    Ok(())
+                }
+                _ => Err(ArrowError::ParseError(
+                    "Promotion Int->Double target mismatch".into(),
+                )),
+            },
+            Promotion::LongToFloat => match self {
+                Self::Float32(v) => {
+                    v.push(buf.get_long()? as f32);
+                    Ok(())
+                }
+                _ => Err(ArrowError::ParseError(
+                    "Promotion Long->Float target mismatch".into(),
+                )),
+            },
+            Promotion::LongToDouble => match self {

Review Comment:
   Yes it does, per the 
[spec](https://avro.apache.org/docs/1.11.1/specification/#schema-resolution)
   
   ```
   long is promotable to float or double
   ```
   
   100% get what you're saying though.



-- 
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]

Reply via email to