Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
test type correctness
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Nov 23, 2021
1 parent 93da1ff commit 84c0058
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/array/fixed_size_binary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 84c0058

Please sign in to comment.