@@ -779,6 +779,34 @@ pub trait AsArray: private::Sealed {
779
779
self . as_bytes_opt ( ) . expect ( "binary array" )
780
780
}
781
781
782
+ /// Downcast this to a [`StringViewArray`] returning `None` if not possible
783
+ fn as_string_view ( & self ) -> & StringViewArray {
784
+ self . as_bytes_view_opt ( ) . expect ( "string view array" )
785
+ }
786
+
787
+ /// Downcast this to a [`StringViewArray`] returning `None` if not possible
788
+ fn as_string_view_opt ( & self ) -> Option < & StringViewArray > {
789
+ self . as_bytes_view_opt ( )
790
+ }
791
+
792
+ /// Downcast this to a [`StringViewArray`] returning `None` if not possible
793
+ fn as_binary_view ( & self ) -> & BinaryViewArray {
794
+ self . as_bytes_view_opt ( ) . expect ( "binary view array" )
795
+ }
796
+
797
+ /// Downcast this to a [`BinaryViewArray`] returning `None` if not possible
798
+ fn as_binary_view_opt ( & self ) -> Option < & BinaryViewArray > {
799
+ self . as_bytes_view_opt ( )
800
+ }
801
+
802
+ /// Downcast this to a [`GenericByteViewArray`] returning `None` if not possible
803
+ fn as_bytes_view < T : ByteViewType > ( & self ) -> & GenericByteViewArray < T > {
804
+ self . as_bytes_view_opt ( ) . expect ( "byte view array" )
805
+ }
806
+
807
+ /// Downcast this to a [`GenericByteViewArray`] returning `None` if not possible
808
+ fn as_bytes_view_opt < T : ByteViewType > ( & self ) -> Option < & GenericByteViewArray < T > > ;
809
+
782
810
/// Downcast this to a [`StructArray`] returning `None` if not possible
783
811
fn as_struct_opt ( & self ) -> Option < & StructArray > ;
784
812
@@ -852,6 +880,10 @@ impl AsArray for dyn Array + '_ {
852
880
self . as_any ( ) . downcast_ref ( )
853
881
}
854
882
883
+ fn as_bytes_view_opt < T : ByteViewType > ( & self ) -> Option < & GenericByteViewArray < T > > {
884
+ self . as_any ( ) . downcast_ref ( )
885
+ }
886
+
855
887
fn as_struct_opt ( & self ) -> Option < & StructArray > {
856
888
self . as_any ( ) . downcast_ref ( )
857
889
}
@@ -899,6 +931,10 @@ impl AsArray for ArrayRef {
899
931
self . as_ref ( ) . as_bytes_opt ( )
900
932
}
901
933
934
+ fn as_bytes_view_opt < T : ByteViewType > ( & self ) -> Option < & GenericByteViewArray < T > > {
935
+ self . as_ref ( ) . as_bytes_view_opt ( )
936
+ }
937
+
902
938
fn as_struct_opt ( & self ) -> Option < & StructArray > {
903
939
self . as_ref ( ) . as_struct_opt ( )
904
940
}
0 commit comments