You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2023/04/30 11:39:25 UTC

[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6165: minor: add decimal roundtrip tests for the row format

alamb commented on code in PR #6165:
URL: https://github.com/apache/arrow-datafusion/pull/6165#discussion_r1181215511


##########
datafusion/row/src/lib.rs:
##########
@@ -221,6 +221,56 @@ mod tests {
         vec![Some(5), Some(7), None, Some(0), Some(111)]
     );
 
+    #[test]
+    #[allow(non_snake_case)]

Review Comment:
   Why is this annotation needed?
   
   ```
       #[allow(non_snake_case)]
   ```
   
   
   I removed it locally and clippy till passes



##########
datafusion/row/src/lib.rs:
##########
@@ -221,6 +221,56 @@ mod tests {
         vec![Some(5), Some(7), None, Some(0), Some(111)]
     );
 
+    #[test]
+    #[allow(non_snake_case)]
+    fn test_single_decimal128() -> Result<()> {
+        let v = vec![
+            Some(0),
+            Some(1),
+            None,
+            Some(-1),
+            Some(i128::MIN),
+            Some(i128::MAX),
+        ];
+        let schema =
+            Arc::new(Schema::new(vec![Field::new("a", Decimal128(38, 10), true)]));
+        let a = Decimal128Array::from(v);
+        let batch = RecordBatch::try_new(schema.clone(), vec![Arc::new(a)])?;
+        let mut vector = vec![0; 1024];

Review Comment:
   Is there some way to ensure that we have enough space rather than using 1024 bytes? I am imagining some future bug or something that accidentally increases the write size for a decimal that will cause this to overflow and thus cause the tests to segfault rather than a nicer error message.



-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org