Skip to content

Commit bf73f15

Browse files
committed
fix doc test
1 parent 7cbbd5a commit bf73f15

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

datafusion-common/src/error.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ use arrow::error::ArrowError;
2626
#[cfg(feature = "avro")]
2727
use avro_rs::Error as AvroError;
2828
use parquet::errors::ParquetError;
29-
#[cfg(feature = "pyarrow")]
30-
use pyo3::exceptions::PyException;
31-
#[cfg(feature = "pyarrow")]
32-
use pyo3::prelude::PyErr;
3329
use sqlparser::parser::ParserError;
3430

3531
/// Result type for operations that could result in an [DataFusionError]
@@ -87,13 +83,6 @@ impl From<ArrowError> for DataFusionError {
8783
}
8884
}
8985

90-
#[cfg(feature = "pyarrow")]
91-
impl From<DataFusionError> for PyErr {
92-
fn from(err: DataFusionError) -> PyErr {
93-
PyException::new_err(err.to_string())
94-
}
95-
}
96-
9786
impl From<DataFusionError> for ArrowError {
9887
fn from(e: DataFusionError) -> Self {
9988
match e {

datafusion-common/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
mod column;
1919
mod dfschema;
2020
mod error;
21+
#[cfg(feature = "pyarrow")]
22+
mod pyarrow;
2123
mod scalar;
2224

2325
pub use column::Column;

datafusion/src/pyarrow.rs renamed to datafusion-common/src/pyarrow.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,21 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
use pyo3::prelude::*;
18+
//! PyArrow
19+
20+
use crate::{DataFusionError, ScalarValue};
21+
use arrow::array::ArrayData;
22+
use arrow::pyarrow::PyArrowConvert;
23+
use pyo3::exceptions::PyException;
24+
use pyo3::prelude::PyErr;
1925
use pyo3::types::PyList;
26+
use pyo3::{FromPyObject, IntoPy, PyAny, PyObject, PyResult, Python};
2027

21-
use crate::arrow::array::ArrayData;
22-
use crate::arrow::pyarrow::PyArrowConvert;
23-
use crate::scalar::ScalarValue;
28+
impl From<DataFusionError> for PyErr {
29+
fn from(err: DataFusionError) -> PyErr {
30+
PyException::new_err(err.to_string())
31+
}
32+
}
2433

2534
impl PyArrowConvert for ScalarValue {
2635
fn from_pyarrow(value: &PyAny) -> PyResult<Self> {
@@ -68,7 +77,6 @@ mod tests {
6877
use pyo3::prepare_freethreaded_python;
6978
use pyo3::py_run;
7079
use pyo3::types::PyDict;
71-
use pyo3::Python;
7280

7381
fn init_python() {
7482
prepare_freethreaded_python();

datafusion-common/src/scalar.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ impl ScalarValue {
665665
///
666666
/// Example
667667
/// ```
668-
/// use datafusion::scalar::ScalarValue;
668+
/// use datafusion_common::ScalarValue;
669669
/// use arrow::array::{ArrayRef, BooleanArray};
670670
///
671671
/// let scalars = vec![

datafusion/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,6 @@ pub use parquet;
224224

225225
pub(crate) mod field_util;
226226

227-
#[cfg(feature = "pyarrow")]
228-
mod pyarrow;
229-
230227
pub mod from_slice;
231228

232229
#[cfg(test)]

0 commit comments

Comments
 (0)