@@ -48,16 +48,24 @@ impl ALPArray {
4848 let mut children = Vec :: with_capacity ( 2 ) ;
4949 children. push ( encoded) ;
5050 if let Some ( patches) = & patches {
51- if patches. dtype ( ) . is_nullable ( ) {
52- vortex_bail ! ( MismatchedTypes : "patches should be non-nullable" , patches. dtype( ) ) ;
51+ if patches. dtype ( ) != & dtype {
52+ vortex_bail ! ( MismatchedTypes : dtype , patches. dtype( ) ) ;
5353 }
54+
55+ if !matches ! (
56+ patches. values( ) . logical_validity( ) ,
57+ LogicalValidity :: AllValid ( _)
58+ ) {
59+ vortex_bail ! ( "ALPArray: patches must not contain invalid entries" ) ;
60+ }
61+
5462 children. push ( patches. indices ( ) . clone ( ) ) ;
5563 children. push ( patches. values ( ) . clone ( ) ) ;
5664 }
5765
5866 let patches = patches
5967 . as_ref ( )
60- . map ( |p| p. to_metadata ( length, & dtype. as_nonnullable ( ) ) )
68+ . map ( |p| p. to_metadata ( length, & dtype) )
6169 . transpose ( ) ?;
6270
6371 Self :: try_from_parts (
@@ -96,7 +104,7 @@ impl ALPArray {
96104 . child ( 1 , & p. indices_dtype ( ) , p. len ( ) )
97105 . vortex_expect ( "ALPArray: patch indices" ) ,
98106 self . as_ref ( )
99- . child ( 2 , & self . dtype ( ) . as_nonnullable ( ) , p. len ( ) )
107+ . child ( 2 , & self . dtype ( ) , p. len ( ) )
100108 . vortex_expect ( "ALPArray: patch values" ) ,
101109 )
102110 } )
0 commit comments