File tree 2 files changed +11
-5
lines changed 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,8 @@ impl<W: Write + Send> ArrowWriter<W> {
259
259
for chunk in in_progress. close ( ) ? {
260
260
chunk. append_to_row_group ( & mut row_group_writer) ?;
261
261
}
262
- row_group_writer. close ( ) ?;
262
+ let row_group_metadata = row_group_writer. close ( ) ?;
263
+ self . writer . write_bloom_filters ( & mut [ row_group_metadata. to_thrift ( ) ] ) ?;
263
264
Ok ( ( ) )
264
265
}
265
266
Original file line number Diff line number Diff line change @@ -274,13 +274,19 @@ impl<W: Write + Send> SerializedFileWriter<W> {
274
274
}
275
275
276
276
/// Serialize all the bloom filter to the file
277
- fn write_bloom_filters ( & mut self , row_groups : & mut [ RowGroup ] ) -> Result < ( ) > {
277
+ pub fn write_bloom_filters ( & mut self , row_groups : & mut [ RowGroup ] ) -> Result < ( ) > {
278
278
// iter row group
279
279
// iter each column
280
280
// write bloom filter to the file
281
- for ( row_group_idx, row_group) in row_groups. iter_mut ( ) . enumerate ( ) {
281
+ for row_group in row_groups. iter_mut ( ) {
282
+ let row_group_idx: u16 = row_group
283
+ . ordinal
284
+ . expect ( "Missing row group ordinal" )
285
+ . try_into ( )
286
+ . expect ( "Negative row group ordinal" ) ;
287
+ let row_group_idx = row_group_idx as usize ;
282
288
for ( column_idx, column_chunk) in row_group. columns . iter_mut ( ) . enumerate ( ) {
283
- match & self . bloom_filters [ row_group_idx] [ column_idx] {
289
+ match self . bloom_filters [ row_group_idx] [ column_idx] . take ( ) {
284
290
Some ( bloom_filter) => {
285
291
let start_offset = self . buf . bytes_written ( ) ;
286
292
bloom_filter. write ( & mut self . buf ) ?;
@@ -338,7 +344,6 @@ impl<W: Write + Send> SerializedFileWriter<W> {
338
344
. map ( |v| v. to_thrift ( ) )
339
345
. collect :: < Vec < _ > > ( ) ;
340
346
341
- self . write_bloom_filters ( & mut row_groups) ?;
342
347
// Write column indexes and offset indexes
343
348
self . write_column_indexes ( & mut row_groups) ?;
344
349
self . write_offset_indexes ( & mut row_groups) ?;
You can’t perform that action at this time.
0 commit comments