From e907bf8e3df5cd8cba8b5f761f9291f2ec0c2730 Mon Sep 17 00:00:00 2001 From: Jay Zhan Date: Wed, 6 Nov 2024 19:50:08 +0800 Subject: [PATCH] Minor: fix misleading comment in byte view (#6695) * fix comment Signed-off-by: jayzhan211 * Update arrow-array/src/cast.rs Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com> --------- Signed-off-by: jayzhan211 Co-authored-by: Raphael Taylor-Davies <1781103+tustvold@users.noreply.github.com> --- arrow-array/src/cast.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/arrow-array/src/cast.rs b/arrow-array/src/cast.rs index 8c7cc2a12f62..501e85ced22a 100644 --- a/arrow-array/src/cast.rs +++ b/arrow-array/src/cast.rs @@ -778,19 +778,14 @@ pub trait AsArray: private::Sealed { self.as_bytes_opt().expect("binary array") } - /// Downcast this to a [`StringViewArray`] returning `None` if not possible - fn as_string_view(&self) -> &StringViewArray { - self.as_byte_view_opt().expect("string view array") - } - /// Downcast this to a [`StringViewArray`] returning `None` if not possible fn as_string_view_opt(&self) -> Option<&StringViewArray> { self.as_byte_view_opt() } - /// Downcast this to a [`StringViewArray`] returning `None` if not possible - fn as_binary_view(&self) -> &BinaryViewArray { - self.as_byte_view_opt().expect("binary view array") + /// Downcast this to a [`StringViewArray`] panicking if not possible + fn as_string_view(&self) -> &StringViewArray { + self.as_byte_view_opt().expect("string view array") } /// Downcast this to a [`BinaryViewArray`] returning `None` if not possible @@ -798,14 +793,19 @@ pub trait AsArray: private::Sealed { self.as_byte_view_opt() } - /// Downcast this to a [`GenericByteViewArray`] returning `None` if not possible - fn as_byte_view(&self) -> &GenericByteViewArray { - self.as_byte_view_opt().expect("byte view array") + /// Downcast this to a [`BinaryViewArray`] panicking if not possible + fn as_binary_view(&self) -> &BinaryViewArray { + self.as_byte_view_opt().expect("binary view array") } /// Downcast this to a [`GenericByteViewArray`] returning `None` if not possible fn as_byte_view_opt(&self) -> Option<&GenericByteViewArray>; + /// Downcast this to a [`GenericByteViewArray`] panicking if not possible + fn as_byte_view(&self) -> &GenericByteViewArray { + self.as_byte_view_opt().expect("byte view array") + } + /// Downcast this to a [`StructArray`] returning `None` if not possible fn as_struct_opt(&self) -> Option<&StructArray>;