Skip to content

Commit 829bcba

Browse files
committed
fix arrow2 python error
1 parent d544e32 commit 829bcba

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

connectorx-python/src/arrow2.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,16 @@ fn to_ptrs(
3838
let mut result = vec![];
3939
let names = schema.fields.iter().map(|f| f.name.clone()).collect();
4040

41-
for rb in rbs {
41+
for rb in rbs.into_iter() {
4242
let mut cols = vec![];
4343

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+
5551
cols.push((array_ptr as uintptr_t, schema_ptr as uintptr_t));
5652
}
5753

connectorx/src/destinations/arrow2/funcs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::typesystem::{ParameterizedFunc, ParameterizedOn};
55
use anyhow::anyhow;
66
use arrow2::array::{Array, MutableArray};
77
use arrow2::datatypes::Field;
8-
use std::sync::Arc;
98

109
pub struct FNewBuilder;
1110

connectorx/src/destinations/arrow2/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub use errors::{Arrow2DestinationError, Result};
1818
use fehler::throw;
1919
use fehler::throws;
2020
use funcs::{FFinishBuilder, FNewBuilder, FNewField};
21-
use polars::prelude::{ArrowField, DataFrame, PolarsError, Series};
21+
use polars::prelude::{DataFrame, PolarsError, Series};
2222
use std::convert::TryFrom;
2323
use std::sync::{Arc, Mutex};
2424
pub use typesystem::Arrow2TypeSystem;
@@ -137,7 +137,7 @@ impl Arrow2Destination {
137137
.into_iter()
138138
.zip(chunks.1)
139139
.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(|_| {
141141
PolarsError::ComputeError("Couldn't build Series from box".into())
142142
});
143143
a

0 commit comments

Comments
 (0)