File tree 3 files changed +12
-2
lines changed
arrow-integration-testing/src
3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,12 @@ impl FFI_ArrowArray {
168
168
. collect :: < Box < _ > > ( ) ;
169
169
let n_children = children. len ( ) as i64 ;
170
170
171
+ // As in the IPC format, emit null_count = length for Null type
172
+ let null_count = match data. data_type ( ) {
173
+ DataType :: Null => data. len ( ) ,
174
+ _ => data. null_count ( ) ,
175
+ } ;
176
+
171
177
// create the private data owning everything.
172
178
// any other data must be added here, e.g. via a struct, to track lifetime.
173
179
let mut private_data = Box :: new ( ArrayPrivateData {
@@ -179,7 +185,7 @@ impl FFI_ArrowArray {
179
185
180
186
Self {
181
187
length : data. len ( ) as i64 ,
182
- null_count : data . null_count ( ) as i64 ,
188
+ null_count : null_count as i64 ,
183
189
offset : data. offset ( ) as i64 ,
184
190
n_buffers,
185
191
n_children,
Original file line number Diff line number Diff line change @@ -247,6 +247,7 @@ fn cdata_integration_import_batch_and_compare_to_json(
247
247
let imported_array = unsafe { std:: ptr:: replace ( c_array, FFI_ArrowArray :: empty ( ) ) } ;
248
248
let imported_array =
249
249
from_ffi_and_data_type ( imported_array, DataType :: Struct ( schema. fields . clone ( ) ) ) ?;
250
+ imported_array. validate_full ( ) ?;
250
251
let imported_batch = RecordBatch :: from ( StructArray :: from ( imported_array) ) ;
251
252
252
253
compare_batches ( & json_batch, & imported_batch)
Original file line number Diff line number Diff line change @@ -271,7 +271,10 @@ impl<'a> ImportedArrowArray<'a> {
271
271
fn consume ( self ) -> Result < ArrayData > {
272
272
let len = self . array . len ( ) ;
273
273
let offset = self . array . offset ( ) ;
274
- let null_count = self . array . null_count ( ) ;
274
+ let null_count = match & self . data_type {
275
+ DataType :: Null => 0 ,
276
+ _ => self . array . null_count ( ) ,
277
+ } ;
275
278
276
279
let data_layout = layout ( & self . data_type ) ;
277
280
let buffers = self . buffers ( data_layout. can_contain_null_mask ) ?;
You can’t perform that action at this time.
0 commit comments