@@ -22,7 +22,6 @@ use crate::error::{DataFusionError, Result};
22
22
use crate :: execution:: context:: TaskContext ;
23
23
use crate :: physical_plan:: metrics:: MemTrackingMetrics ;
24
24
use crate :: physical_plan:: { displayable, ColumnStatistics , ExecutionPlan , Statistics } ;
25
- use arrow:: compute:: concat;
26
25
use arrow:: datatypes:: { Schema , SchemaRef } ;
27
26
use arrow:: error:: ArrowError ;
28
27
use arrow:: error:: Result as ArrowResult ;
@@ -96,32 +95,6 @@ pub async fn collect(stream: SendableRecordBatchStream) -> Result<Vec<RecordBatc
96
95
. map_err ( DataFusionError :: from)
97
96
}
98
97
99
- /// Combine a slice of record batches into one, or returns None if the slice itself
100
- /// is empty; all the record batches inside the slice must be of the same schema.
101
- pub ( crate ) fn combine_batches (
102
- batches : & [ RecordBatch ] ,
103
- schema : SchemaRef ,
104
- ) -> ArrowResult < Option < RecordBatch > > {
105
- if batches. is_empty ( ) {
106
- Ok ( None )
107
- } else {
108
- let columns = schema
109
- . fields ( )
110
- . iter ( )
111
- . enumerate ( )
112
- . map ( |( i, _) | {
113
- concat (
114
- & batches
115
- . iter ( )
116
- . map ( |batch| batch. column ( i) . as_ref ( ) )
117
- . collect :: < Vec < _ > > ( ) ,
118
- )
119
- } )
120
- . collect :: < ArrowResult < Vec < _ > > > ( ) ?;
121
- Ok ( Some ( RecordBatch :: try_new ( schema. clone ( ) , columns) ?) )
122
- }
123
- }
124
-
125
98
/// Recursively builds a list of files in a directory with a given extension
126
99
pub fn build_checked_file_list ( dir : & str , ext : & str ) -> Result < Vec < String > > {
127
100
let mut filenames: Vec < String > = Vec :: new ( ) ;
@@ -303,46 +276,6 @@ mod tests {
303
276
record_batch:: RecordBatch ,
304
277
} ;
305
278
306
- #[ test]
307
- fn test_combine_batches_empty ( ) -> Result < ( ) > {
308
- let schema = Arc :: new ( Schema :: new ( vec ! [
309
- Field :: new( "f32" , DataType :: Float32 , false ) ,
310
- Field :: new( "f64" , DataType :: Float64 , false ) ,
311
- ] ) ) ;
312
- let result = combine_batches ( & [ ] , schema) ?;
313
- assert ! ( result. is_none( ) ) ;
314
- Ok ( ( ) )
315
- }
316
-
317
- #[ test]
318
- fn test_combine_batches ( ) -> Result < ( ) > {
319
- let schema = Arc :: new ( Schema :: new ( vec ! [
320
- Field :: new( "f32" , DataType :: Float32 , false ) ,
321
- Field :: new( "f64" , DataType :: Float64 , false ) ,
322
- ] ) ) ;
323
-
324
- let batch_count = 1000 ;
325
- let batch_size = 10 ;
326
- let batches = ( 0 ..batch_count)
327
- . map ( |i| {
328
- RecordBatch :: try_new (
329
- Arc :: clone ( & schema) ,
330
- vec ! [
331
- Arc :: new( Float32Array :: from_slice( vec![ i as f32 ; batch_size] ) ) ,
332
- Arc :: new( Float64Array :: from_slice( vec![ i as f64 ; batch_size] ) ) ,
333
- ] ,
334
- )
335
- . unwrap ( )
336
- } )
337
- . collect :: < Vec < _ > > ( ) ;
338
-
339
- let result = combine_batches ( & batches, schema) ?;
340
- assert ! ( result. is_some( ) ) ;
341
- let result = result. unwrap ( ) ;
342
- assert_eq ! ( batch_count * batch_size, result. num_rows( ) ) ;
343
- Ok ( ( ) )
344
- }
345
-
346
279
#[ test]
347
280
fn test_compute_record_batch_statistics_empty ( ) -> Result < ( ) > {
348
281
let schema = Arc :: new ( Schema :: new ( vec ! [
0 commit comments