@@ -300,11 +300,12 @@ def string_column_to_ndarray(col: Column) -> tuple[np.ndarray, Any]:
300300 if null_kind in (ColumnNullType .USE_BITMASK , ColumnNullType .USE_BYTEMASK ):
301301 assert buffers ["validity" ], "Validity buffers cannot be empty for masks"
302302 valid_buff , valid_dtype = buffers ["validity" ]
303- null_pos = buffer_to_ndarray (
304- valid_buff , valid_dtype , offset = col .offset , length = col .size ()
305- )
306- if sentinel_val == 0 :
307- null_pos = ~ null_pos
303+ if valid_buff is not None :
304+ null_pos = buffer_to_ndarray (
305+ valid_buff , valid_dtype , offset = col .offset , length = col .size ()
306+ )
307+ if sentinel_val == 0 :
308+ null_pos = ~ null_pos
308309
309310 # Assemble the strings from the code units
310311 str_list : list [None | float | str ] = [None ] * col .size ()
@@ -527,11 +528,12 @@ def set_nulls(
527528 elif null_kind in (ColumnNullType .USE_BITMASK , ColumnNullType .USE_BYTEMASK ):
528529 assert validity , "Expected to have a validity buffer for the mask"
529530 valid_buff , valid_dtype = validity
530- null_pos = buffer_to_ndarray (
531- valid_buff , valid_dtype , offset = col .offset , length = col .size ()
532- )
533- if sentinel_val == 0 :
534- null_pos = ~ null_pos
531+ if valid_buff is not None :
532+ null_pos = buffer_to_ndarray (
533+ valid_buff , valid_dtype , offset = col .offset , length = col .size ()
534+ )
535+ if sentinel_val == 0 :
536+ null_pos = ~ null_pos
535537 elif null_kind in (ColumnNullType .NON_NULLABLE , ColumnNullType .USE_NAN ):
536538 pass
537539 else :
0 commit comments