You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "tustvold (via GitHub)" <gi...@apache.org> on 2023/03/23 22:57:51 UTC

[GitHub] [arrow-rs] tustvold commented on a diff in pull request #3923: Deprecate Array::data_ref (#3880)

tustvold commented on code in PR #3923:
URL: https://github.com/apache/arrow-rs/pull/3923#discussion_r1146956801


##########
arrow/tests/array_validation.rs:
##########
@@ -996,28 +995,8 @@ fn test_string_data_from_foreign() {
 
 #[test]
 fn test_decimal_full_validation() {
-    let values_builder = UInt8Builder::with_capacity(10);
-    let byte_width = 16;
-    let mut fixed_size_builder = FixedSizeListBuilder::new(values_builder, byte_width);
-    let value_as_bytes = 123456_i128.to_le_bytes();
-    fixed_size_builder
-        .values()
-        .append_slice(value_as_bytes.as_slice());
-    fixed_size_builder.append(true);
-    let fixed_size_array = fixed_size_builder.finish();
-
-    // Build ArrayData for Decimal
-    let builder = ArrayData::builder(DataType::Decimal128(5, 3))
-        .len(fixed_size_array.len())
-        .add_buffer(fixed_size_array.data_ref().child_data()[0].buffers()[0].clone());
-    let array_data = unsafe { builder.build_unchecked() };
-    array_data.validate_full().unwrap();
-
-    let array = Decimal128Array::from(array_data);
-    let error = array
-        .validate_decimal_precision(array.precision())
-        .unwrap_err();
-
+    let array = Decimal128Array::from(vec![123456_i128]);

Review Comment:
   This test dates from before decimals were just a PrimitiveArray - we've come a long way in terms of ergonomics :sweat_smile: 



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