@@ -639,6 +639,7 @@ where
639639 if array. is_null ( row_index)
640640 || from_array. is_null ( row_index)
641641 || to_array. is_null ( row_index)
642+ || stride. map_or ( false , |s| s. is_null ( row_index) )
642643 {
643644 mutable. extend_nulls ( 1 ) ;
644645 offsets. push ( offsets[ row_index] + O :: usize_as ( 1 ) ) ;
@@ -726,6 +727,7 @@ where
726727 if array. is_null ( row_index)
727728 || from_array. is_null ( row_index)
728729 || to_array. is_null ( row_index)
730+ || stride. map_or ( false , |s| s. is_null ( row_index) )
729731 {
730732 null_builder. append_null ( ) ;
731733 offsets. push ( current_offset) ;
@@ -1324,6 +1326,32 @@ mod tests {
13241326 vec![ vec![ Some ( 1 ) , None ] , vec![ Some ( 3 ) , Some ( 4 ) ] , Vec :: new( ) , ]
13251327 ) ;
13261328
1329+ // Test with NULL stride - should return NULL for rows with NULL stride
1330+ let stride_with_null = Int64Array :: from ( vec ! [ Some ( 1 ) , None , Some ( 1 ) ] ) ;
1331+ let result = general_list_view_array_slice :: < i32 > (
1332+ & array,
1333+ & from,
1334+ & to,
1335+ Some ( & stride_with_null) ,
1336+ ) ?;
1337+ let result = result. as_ref ( ) . as_list_view :: < i32 > ( ) ;
1338+
1339+ // First row: stride = 1, should return [1, None]
1340+ // Second row: stride = NULL, should return NULL
1341+ // Third row: stride = 1, empty array should return empty
1342+ assert ! ( !result. is_null( 0 ) ) ; // First row should not be null
1343+ assert ! ( result. is_null( 1 ) ) ; // Second row should be null (stride is NULL)
1344+ assert ! ( !result. is_null( 2 ) ) ; // Third row should not be null
1345+
1346+ let first_row: Vec < Option < i32 > > = result
1347+ . value ( 0 )
1348+ . as_any ( )
1349+ . downcast_ref :: < Int32Array > ( )
1350+ . unwrap ( )
1351+ . iter ( )
1352+ . collect ( ) ;
1353+ assert_eq ! ( first_row, vec![ Some ( 1 ) , None ] ) ;
1354+
13271355 Ok ( ( ) )
13281356 }
13291357}
0 commit comments