File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
vortex-array/src/arrays/varbin Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -491,18 +491,11 @@ impl Array<VarBin> {
491491 validity : Validity ,
492492 ) -> VortexResult < Self > {
493493 let len = offsets. len ( ) - 1 ;
494+ let bytes = BufferHandle :: new_host ( bytes) ;
495+ VarBinData :: validate ( & offsets, & bytes, & dtype, & validity) ?;
494496 let slots = VarBinData :: make_slots ( offsets, & validity, len) ;
495- let data = unsafe {
496- VarBinData :: new_unchecked_from_handle (
497- slots[ OFFSETS_SLOT ]
498- . as_ref ( )
499- . vortex_expect ( "VarBinArray offsets slot" )
500- . clone ( ) ,
501- bytes,
502- dtype. clone ( ) ,
503- validity,
504- )
505- } ?;
497+ // SAFETY: validate ensures all invariants are met.
498+ let data = unsafe { VarBinData :: new_unchecked_from_handle ( bytes) } ;
506499 Ok ( unsafe {
507500 Array :: from_parts_unchecked ( ArrayParts :: new ( VarBin , dtype, len, data) . with_slots ( slots) )
508501 } )
You can’t perform that action at this time.
0 commit comments