From 00bbe7985ede2149d520bf7e2d565869985c0e2b Mon Sep 17 00:00:00 2001 From: Siew Kam Onn Date: Sat, 11 Apr 2026 15:04:10 +0800 Subject: [PATCH 1/3] Re-export error helpers from crate root Publicly re-export curated error helpers, including to_datafusion_err, from the crate root. Add a regression test in crates/util/tests/root_exports.rs to ensure correct functionality in an integration-test context. --- crates/util/src/lib.rs | 5 +++-- crates/util/tests/root_exports.rs | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 crates/util/tests/root_exports.rs diff --git a/crates/util/src/lib.rs b/crates/util/src/lib.rs index 5b1c89936..00e8d7516 100644 --- a/crates/util/src/lib.rs +++ b/crates/util/src/lib.rs @@ -32,9 +32,10 @@ use tokio::runtime::Runtime; use tokio::task::JoinHandle; use tokio::time::sleep; -use crate::errors::{PyDataFusionError, PyDataFusionResult, to_datafusion_err}; - pub mod errors; +pub use crate::errors::{ + PyDataFusionError, PyDataFusionResult, py_datafusion_err, to_datafusion_err, +}; /// Utility to get the Tokio Runtime from Python #[inline] diff --git a/crates/util/tests/root_exports.rs b/crates/util/tests/root_exports.rs new file mode 100644 index 000000000..e630cd954 --- /dev/null +++ b/crates/util/tests/root_exports.rs @@ -0,0 +1,23 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +use datafusion_python_util::to_datafusion_err; + +#[test] +fn exports_to_datafusion_err_from_crate_root() { + let _ = to_datafusion_err("importable from crate root"); +} From 69981b6d1198161b8bb4c26a5b63a54979a262aa Mon Sep 17 00:00:00 2001 From: Siew Kam Onn Date: Sat, 11 Apr 2026 15:37:40 +0800 Subject: [PATCH 2/3] Restrict re-exported items in lib.rs Make only to_datafusion_err publicly re-exported from the crate root. Keep PyDataFusionError and PyDataFusionResult as private imports for internal use, enhancing encapsulation and reducing exposure of non-essential components. --- crates/util/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/util/src/lib.rs b/crates/util/src/lib.rs index 00e8d7516..efc676fd5 100644 --- a/crates/util/src/lib.rs +++ b/crates/util/src/lib.rs @@ -33,9 +33,9 @@ use tokio::task::JoinHandle; use tokio::time::sleep; pub mod errors; -pub use crate::errors::{ - PyDataFusionError, PyDataFusionResult, py_datafusion_err, to_datafusion_err, -}; +pub use crate::errors::to_datafusion_err; + +use crate::errors::{PyDataFusionError, PyDataFusionResult}; /// Utility to get the Tokio Runtime from Python #[inline] From 242bc7fa6442923389191a90964cf59497feef73 Mon Sep 17 00:00:00 2001 From: Siew Kam Onn Date: Sat, 11 Apr 2026 16:13:38 +0800 Subject: [PATCH 3/3] feat: remove unnecessary blank line in lib.rs to improve code formatting --- crates/util/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/util/src/lib.rs b/crates/util/src/lib.rs index efc676fd5..267a8b86a 100644 --- a/crates/util/src/lib.rs +++ b/crates/util/src/lib.rs @@ -34,7 +34,6 @@ use tokio::time::sleep; pub mod errors; pub use crate::errors::to_datafusion_err; - use crate::errors::{PyDataFusionError, PyDataFusionResult}; /// Utility to get the Tokio Runtime from Python