File tree 1 file changed +12
-19
lines changed
1 file changed +12
-19
lines changed Original file line number Diff line number Diff line change @@ -25,16 +25,13 @@ pub(crate) fn get_requested_indices(
25
25
. fields ( )
26
26
. iter ( )
27
27
. enumerate ( )
28
- . map (
29
- |( parquet_position, field) | match requested_schema. index_of ( field. name ( ) ) {
30
- Some ( index) => {
31
- found_count += 1 ;
32
- indicies[ index] = parquet_position;
33
- index as i32
34
- }
35
- None => -1 ,
36
- } ,
37
- )
28
+ . filter_map ( |( parquet_position, field) | {
29
+ requested_schema. index_of ( field. name ( ) ) . map ( |index| {
30
+ found_count += 1 ;
31
+ indicies[ index] = parquet_position;
32
+ index as i32
33
+ } )
34
+ } )
38
35
. collect ( ) ;
39
36
if found_count != requested_len {
40
37
return Err ( Error :: generic (
@@ -85,15 +82,11 @@ pub(crate) fn reorder_record_batch(
85
82
let mut fields = Vec :: with_capacity ( indicies. len ( ) ) ;
86
83
let reordered_columns = requested_ordering
87
84
. iter ( )
88
- . filter_map ( |index| {
89
- if * index >= 0 {
90
- let idx = * index as usize ;
91
- // cheap clones of `Arc`s
92
- fields. push ( input_schema. field ( idx) . clone ( ) ) ;
93
- Some ( input_data. column ( idx) . clone ( ) )
94
- } else {
95
- None
96
- }
85
+ . map ( |index| {
86
+ let idx = * index as usize ;
87
+ // cheap clones of `Arc`s
88
+ fields. push ( input_schema. field ( idx) . clone ( ) ) ;
89
+ input_data. column ( idx) . clone ( )
97
90
} )
98
91
. collect ( ) ;
99
92
let schema = Arc :: new ( ArrowSchema :: new ( fields) ) ;
You can’t perform that action at this time.
0 commit comments