-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
344748b
commit 0d5e672
Showing
5 changed files
with
24 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
use std::sync::Arc; | ||
|
||
use crate::ffi::from_python::utils::import_arrow_c_schema; | ||
use crate::field::PyField; | ||
use arrow_schema::Field; | ||
use pyo3::exceptions::PyTypeError; | ||
use pyo3::prelude::*; | ||
use pyo3::{PyAny, PyResult}; | ||
|
||
// TODO: need to update import_arrow_c_schema to not always coerce to a Schema | ||
// impl<'a> FromPyObject<'a> for PyField { | ||
// fn extract(ob: &'a PyAny) -> PyResult<Self> { | ||
// let schema = import_arrow_c_schema(ob)?; | ||
// schema.fi | ||
// Ok(Self(schema)) | ||
// } | ||
// } | ||
impl<'a> FromPyObject<'a> for PyField { | ||
fn extract(ob: &'a PyAny) -> PyResult<Self> { | ||
let schema_ptr = import_arrow_c_schema(ob)?; | ||
let field = | ||
Field::try_from(schema_ptr).map_err(|err| PyTypeError::new_err(err.to_string()))?; | ||
Ok(Self::new(Arc::new(field))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
use std::sync::Arc; | ||
|
||
use crate::ffi::from_python::utils::import_arrow_c_schema; | ||
use crate::schema::PySchema; | ||
use arrow_schema::Schema; | ||
use pyo3::exceptions::PyTypeError; | ||
use pyo3::prelude::*; | ||
use pyo3::{PyAny, PyResult}; | ||
|
||
impl<'a> FromPyObject<'a> for PySchema { | ||
fn extract(ob: &'a PyAny) -> PyResult<Self> { | ||
let schema = import_arrow_c_schema(ob)?; | ||
Ok(Self::new(schema)) | ||
let schema_ptr = import_arrow_c_schema(ob)?; | ||
let schema = | ||
Schema::try_from(schema_ptr).map_err(|err| PyTypeError::new_err(err.to_string()))?; | ||
Ok(Self::new(Arc::new(schema))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters