From 84c00582b0d11bd986f8236291bb521df43dda8b Mon Sep 17 00:00:00 2001 From: Ritchie Vink Date: Tue, 23 Nov 2021 08:55:49 +0100 Subject: [PATCH] test type correctness --- src/array/fixed_size_binary/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/array/fixed_size_binary/mod.rs b/src/array/fixed_size_binary/mod.rs index 959e9cd3b64..1a349260960 100644 --- a/src/array/fixed_size_binary/mod.rs +++ b/src/array/fixed_size_binary/mod.rs @@ -138,8 +138,19 @@ impl FixedSizeBinaryArray { /// Returns a new [`FixedSizeBinary`] with a different logical type. /// This is `O(1)`. + /// # Panics + /// Panics iff the data_type is not supported for the physical type. #[inline] pub fn to(self, data_type: DataType) -> Self { + match ( + data_type.to_physical_type(), + self.data_type().to_physical_type(), + ) { + (DataType::FixedSizeBinary(size_a), DataType::FixedSizeBinary(size_b)) + if size_a == size_b => {} + _ => panic!("Wrong DataType"), + } + Self { size: self.size, data_type,