Skip to content

Export to_datafusion_err from the util crate root#1487

Draft
kosiew wants to merge 3 commits intoapache:mainfrom
kosiew:util-1431
Draft

Export to_datafusion_err from the util crate root#1487
kosiew wants to merge 3 commits intoapache:mainfrom
kosiew:util-1431

Conversation

@kosiew
Copy link
Copy Markdown
Contributor

@kosiew kosiew commented Apr 11, 2026

Which issue does this PR close?

Rationale for this change

Users currently cannot import to_datafusion_err directly from datafusion_python_util, even though the function is already public in errors.rs. This creates an inconsistency between the function’s visibility and how consumers expect to access it from the crate root.

This change fixes that mismatch by re-exporting to_datafusion_err from lib.rs, making the crate’s public API behave as expected and resolving the private item import error reported in the issue.

What changes are included in this PR?

This PR makes a small public API cleanup in the util crate:

  • Re-exports to_datafusion_err from the crate root with pub use crate::errors::to_datafusion_err;
  • Updates the internal use statement in lib.rs so the root re-export and internal imports are separated cleanly
  • Adds a regression test in crates/util/tests/root_exports.rs to verify that to_datafusion_err can be imported from datafusion_python_util

Are these changes tested?

Yes.

This PR adds a regression test, exports_to_datafusion_err_from_crate_root, which imports to_datafusion_err from datafusion_python_util and verifies that the symbol is available from the crate root. This helps prevent future regressions in the crate’s public exports.

Are there any user-facing changes?

Yes.

to_datafusion_err is now importable directly from the datafusion_python_util crate root:

use datafusion_python_util::to_datafusion_err;

This is a small user-facing API improvement, but it is not a breaking change.

LLM-generated code disclosure

This PR includes code, comments generated with assistance from LLM. All LLM-generated content has been manually reviewed and tested.

kosiew added 3 commits April 11, 2026 15:31
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.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minor annoyance with the util crate

1 participant