File tree Expand file tree Collapse file tree 3 files changed +10
-15
lines changed
connectorx/src/destinations/arrow2 Expand file tree Collapse file tree 3 files changed +10
-15
lines changed Original file line number Diff line number Diff line change @@ -38,20 +38,16 @@ fn to_ptrs(
38
38
let mut result = vec ! [ ] ;
39
39
let names = schema. fields . iter ( ) . map ( |f| f. name . clone ( ) ) . collect ( ) ;
40
40
41
- for rb in rbs {
41
+ for rb in rbs. into_iter ( ) {
42
42
let mut cols = vec ! [ ] ;
43
43
44
- for array in rb. columns ( ) {
45
- let array_ptr = Box :: new ( ffi:: ArrowArray :: empty ( ) ) ;
46
- let schema_ptr = Box :: new ( ffi:: ArrowSchema :: empty ( ) ) ;
47
- let array_ptr = Box :: into_raw ( array_ptr) ;
48
- let schema_ptr = Box :: into_raw ( schema_ptr) ;
49
- unsafe {
50
- ffi:: export_field_to_c (
51
- & Field :: new ( "" , array. data_type ( ) . clone ( ) , true ) ,
52
- ) ;
53
- ffi:: export_array_to_c ( array. clone ( ) ) ;
54
- } ;
44
+ for array in rb. into_arrays ( ) {
45
+ let schema_ptr =
46
+ ffi:: export_field_to_c ( & Field :: new ( "" , array. data_type ( ) . clone ( ) , true ) ) ;
47
+ let array_ptr = ffi:: export_array_to_c ( array) ;
48
+ let array_ptr = Box :: into_raw ( Box :: new ( array_ptr) ) ;
49
+ let schema_ptr = Box :: into_raw ( Box :: new ( schema_ptr) ) ;
50
+
55
51
cols. push ( ( array_ptr as uintptr_t , schema_ptr as uintptr_t ) ) ;
56
52
}
57
53
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ use crate::typesystem::{ParameterizedFunc, ParameterizedOn};
5
5
use anyhow:: anyhow;
6
6
use arrow2:: array:: { Array , MutableArray } ;
7
7
use arrow2:: datatypes:: Field ;
8
- use std:: sync:: Arc ;
9
8
10
9
pub struct FNewBuilder ;
11
10
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ pub use errors::{Arrow2DestinationError, Result};
18
18
use fehler:: throw;
19
19
use fehler:: throws;
20
20
use funcs:: { FFinishBuilder , FNewBuilder , FNewField } ;
21
- use polars:: prelude:: { ArrowField , DataFrame , PolarsError , Series } ;
21
+ use polars:: prelude:: { DataFrame , PolarsError , Series } ;
22
22
use std:: convert:: TryFrom ;
23
23
use std:: sync:: { Arc , Mutex } ;
24
24
pub use typesystem:: Arrow2TypeSystem ;
@@ -137,7 +137,7 @@ impl Arrow2Destination {
137
137
. into_iter ( )
138
138
. zip ( chunks. 1 )
139
139
. map ( |( arr, field) | {
140
- let a = Series :: try_from ( ( field. name . as_str ( ) , arr) ) . map_err ( |er | {
140
+ let a = Series :: try_from ( ( field. name . as_str ( ) , arr) ) . map_err ( |_ | {
141
141
PolarsError :: ComputeError ( "Couldn't build Series from box" . into ( ) )
142
142
} ) ;
143
143
a
You can’t perform that action at this time.
0 commit comments