mgill25 commented on a change in pull request #273:
URL: https://github.com/apache/arrow-rs/pull/273#discussion_r630614945



##########
File path: arrow/src/util/display.rs
##########
@@ -296,3 +297,48 @@ fn dict_array_value_to_string<K: ArrowPrimitiveType>(
 
     array_value_to_string(&dict_array.values(), dict_index)
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use crate::{
+        array::ArrayRef,
+        array::{ArrayData, DecimalArray, Int32Array},
+    };
+    use crate::{buffer::Buffer, datatypes::DataType};
+    use std::sync::Arc;
+
+    #[test]
+    fn test_int_display() -> Result<()> {
+        let array = Arc::new(Int32Array::from(vec![6, 3])) as ArrayRef;
+        let actual_one = array_value_to_string(&array, 0).unwrap();
+        let expected_one = String::from("6");
+
+        let actual_two = array_value_to_string(&array, 1).unwrap();
+        let expected_two = String::from("3");
+        assert_eq!(actual_one, expected_one);
+        assert_eq!(actual_two, expected_two);
+        Ok(())
+    }
+
+    #[test]
+    fn test_decimal_display() -> Result<()> {
+        let values: [u8; 32] = [

Review comment:
       Thanks a lot for your guidance. I was wondering exactly this - how to 
use `DecimalBuilder` and how to think in terms of real numbers instead of bytes 
during creation of test data. 😅 




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to