@@ -49,6 +49,8 @@ macro_rules! impl_append_to_builder {
4949 if NULLABLE {
5050 let mut ptr = self . element_offset as * const $element_type;
5151 let null_words = self . null_bitset_ptr( ) ;
52+ debug_assert!( !null_words. is_null( ) , "null_bitset_ptr is null" ) ;
53+ debug_assert!( !ptr. is_null( ) , "element_offset pointer is null" ) ;
5254 for idx in 0 ..num_elements {
5355 let word_idx = idx >> 6 ;
5456 let bit_idx = idx & 0x3f ;
@@ -66,6 +68,7 @@ macro_rules! impl_append_to_builder {
6668 }
6769 } else {
6870 // SAFETY: element_offset points to contiguous data of length num_elements
71+ debug_assert!( self . element_offset != 0 , "element_offset is null" ) ;
6972 let slice = unsafe {
7073 std:: slice:: from_raw_parts(
7174 self . element_offset as * const $element_type,
@@ -168,9 +171,17 @@ impl SparkUnsafeArray {
168171 }
169172
170173 let mut ptr = self . element_offset as * const u8 ;
174+ debug_assert ! (
175+ !ptr. is_null( ) ,
176+ "append_booleans: element_offset pointer is null"
177+ ) ;
171178
172179 if NULLABLE {
173180 let null_words = self . null_bitset_ptr ( ) ;
181+ debug_assert ! (
182+ !null_words. is_null( ) ,
183+ "append_booleans: null_bitset_ptr is null"
184+ ) ;
174185 for idx in 0 ..num_elements {
175186 let word_idx = idx >> 6 ;
176187 let bit_idx = idx & 0x3f ;
@@ -208,6 +219,14 @@ impl SparkUnsafeArray {
208219 if NULLABLE {
209220 let mut ptr = self . element_offset as * const i64 ;
210221 let null_words = self . null_bitset_ptr ( ) ;
222+ debug_assert ! (
223+ !null_words. is_null( ) ,
224+ "append_timestamps: null_bitset_ptr is null"
225+ ) ;
226+ debug_assert ! (
227+ !ptr. is_null( ) ,
228+ "append_timestamps: element_offset pointer is null"
229+ ) ;
211230 for idx in 0 ..num_elements {
212231 let word_idx = idx >> 6 ;
213232 let bit_idx = idx & 0x3f ;
@@ -225,6 +244,10 @@ impl SparkUnsafeArray {
225244 }
226245 } else {
227246 // SAFETY: element_offset points to contiguous i64 data of length num_elements
247+ debug_assert ! (
248+ self . element_offset != 0 ,
249+ "append_timestamps: element_offset is null"
250+ ) ;
228251 let slice = unsafe {
229252 std:: slice:: from_raw_parts ( self . element_offset as * const i64 , num_elements)
230253 } ;
@@ -245,6 +268,14 @@ impl SparkUnsafeArray {
245268 if NULLABLE {
246269 let mut ptr = self . element_offset as * const i32 ;
247270 let null_words = self . null_bitset_ptr ( ) ;
271+ debug_assert ! (
272+ !null_words. is_null( ) ,
273+ "append_dates: null_bitset_ptr is null"
274+ ) ;
275+ debug_assert ! (
276+ !ptr. is_null( ) ,
277+ "append_dates: element_offset pointer is null"
278+ ) ;
248279 for idx in 0 ..num_elements {
249280 let word_idx = idx >> 6 ;
250281 let bit_idx = idx & 0x3f ;
@@ -262,6 +293,10 @@ impl SparkUnsafeArray {
262293 }
263294 } else {
264295 // SAFETY: element_offset points to contiguous i32 data of length num_elements
296+ debug_assert ! (
297+ self . element_offset != 0 ,
298+ "append_dates: element_offset is null"
299+ ) ;
265300 let slice = unsafe {
266301 std:: slice:: from_raw_parts ( self . element_offset as * const i32 , num_elements)
267302 } ;
0 commit comments