Skip to content

Commit

Permalink
Update pyarrow method call with kwargs (#3560)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frankonly committed Jan 19, 2023
1 parent de62808 commit d980235
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arrow/src/pyarrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use std::sync::Arc;
use pyo3::ffi::Py_uintptr_t;
use pyo3::import_exception;
use pyo3::prelude::*;
use pyo3::types::{PyList, PyTuple};
use pyo3::types::{PyDict, PyList, PyTuple};

use crate::array::{make_array, Array, ArrayData};
use crate::datatypes::{DataType, Field, Schema};
Expand Down Expand Up @@ -196,8 +196,10 @@ impl PyArrowConvert for RecordBatch {

let module = py.import("pyarrow")?;
let class = module.getattr("RecordBatch")?;
let record = class
.call_method1("from_arrays", (py_arrays, None::<PyObject>, py_schema))?;
let args = (py_arrays,);
let kwargs = PyDict::new(py);
kwargs.set_item("schema", py_schema)?;
let record = class.call_method("from_arrays", args, Some(kwargs))?;

Ok(PyObject::from(record))
}
Expand Down

0 comments on commit d980235

Please sign in to comment.