scovich commented on code in PR #7644:
URL: https://github.com/apache/arrow-rs/pull/7644#discussion_r2140512664


##########
parquet-variant/src/decoder.rs:
##########
@@ -112,14 +218,222 @@ mod tests {
     #[test]
     fn test_i8() -> Result<(), ArrowError> {
         let value = [
-            3 << 2, // Primitive type for i8
-            42,
+            (VariantPrimitiveType::Int8 as u8) << 2, // Basic type
+            0x2a,                                    // Data
         ];
         let result = decode_int8(&value)?;
         assert_eq!(result, 42);
         Ok(())
     }
 
+    #[test]
+    fn test_i16() -> Result<(), ArrowError> {
+        let value = [
+            (VariantPrimitiveType::Int16 as u8) << 2, // Basic type
+            0xd2,
+            0x04, // Data
+        ];
+        let result = decode_int16(&value)?;
+        assert_eq!(result, 1234);
+        Ok(())
+    }
+
+    #[test]
+    fn test_i32() -> Result<(), ArrowError> {
+        let value = [
+            (VariantPrimitiveType::Int32 as u8) << 2, // Basic type
+            0x40,
+            0xe2,
+            0x01,
+            0x00, // Data
+        ];
+        let result = decode_int32(&value)?;
+        assert_eq!(result, 123456);
+        Ok(())
+    }
+
+    #[test]
+    fn test_i64() -> Result<(), ArrowError> {
+        let value = [
+            (VariantPrimitiveType::Int64 as u8) << 2, // Basic type
+            0x15,
+            0x81,
+            0xe9,
+            0x7d,
+            0xf4,
+            0x10,
+            0x22,
+            0x11, // Data
+        ];
+        let result = decode_int64(&value)?;
+        assert_eq!(result, 1234567890123456789);
+        Ok(())
+    }
+
+    #[test]
+    fn test_decimal4() -> Result<(), ArrowError> {

Review Comment:
   Agree. This is untrusted user input, so we have to assume the bytes are 
incorrect in all the worst ways.



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

Reply via email to