You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2023/01/19 09:15:46 UTC

[arrow-rs] branch master updated: Update pyarrow method call with kwargs (#3560)

This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new d9802353f Update pyarrow method call with kwargs (#3560)
d9802353f is described below

commit d9802353f195979f7c6541143c7e849f5ac2d661
Author: Frank <35...@users.noreply.github.com>
AuthorDate: Thu Jan 19 17:15:40 2023 +0800

    Update pyarrow method call with kwargs (#3560)
---
 arrow/src/pyarrow.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arrow/src/pyarrow.rs b/arrow/src/pyarrow.rs
index 4355d2e47..09933304e 100644
--- a/arrow/src/pyarrow.rs
+++ b/arrow/src/pyarrow.rs
@@ -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};
@@ -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))
     }