Skip to content

Re-export rand crate in arrow::util - #10687

Merged
alamb merged 2 commits into
apache:mainfrom
Rich-T-kid:rich-t-kid/reexport-rand-util
Aug 15, 2026
Merged

alamb merged 2 commits into
apache:mainfrom
Rich-T-kid:rich-t-kid/reexport-rand-util

Conversation

@Rich-T-kid

@Rich-T-kid Rich-T-kid commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

bench_util and test_util expose rand types in their public API (e.g. StandardUniform bounds, StdRng return types). Downstream crates on a different rand major version can't satisfy those bounds, causing compile errors.

What changes are included in this PR?

pub use rand; re-export added to arrow::util behind the test_utils feature flag, so callers can import arrow::util::rand::... to get the exact rand version arrow uses.

Are these changes tested?

n/a

Are there any user-facing changes?

yes, users can avoid import conflicts

Downstream crates calling bench_util::create_primitive_array (which has
a StandardUniform: Distribution<T::Native> bound) or
test_util::seedable_rng (which returns rand StdRng) must use the same
rand major version as arrow. Re-exporting rand at arrow::util::rand lets
callers write:

    use arrow::util::rand::distr::{Distribution, StandardUniform};
    use arrow::util::rand::rngs::StdRng;

and be guaranteed the right version regardless of their own rand dep.

Closes apache#10685
@github-actions github-actions Bot added the arrow Changes to the arrow crate label Aug 14, 2026
@Jefffrey Jefffrey added the enhancement New feature/addition label Aug 15, 2026
@Jefffrey Jefffrey changed the title Rich t kid/reexport rand util Re-export rand crate in arrow::util Aug 15, 2026

@alamb alamb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@alamb
alamb merged commit 9a5d9e9 into apache:main Aug 15, 2026
33 checks passed
MassivePizza pushed a commit to massive-com/arrow-rs that referenced this pull request Aug 19, 2026
# Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax.
-->

- Closes apache#10685.

# Rationale for this change
`bench_util` and `test_util` expose rand types in their public API (e.g.
StandardUniform bounds, StdRng return types). Downstream crates on a
different rand major version can't satisfy those bounds, causing compile
errors.
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->

# What changes are included in this PR?

`pub use rand`; re-export added to` arrow::util` behind the `test_utils`
feature flag, so callers can import `arrow::util::rand::..`. to get the
exact rand version arrow uses.
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->

# Are these changes tested?

n/a

<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?

If this PR claims a performance improvement, please include evidence
such as benchmark results.
-->

# Are there any user-facing changes?
yes, users can avoid import conflicts
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.

If there are any breaking changes to public APIs, please call them out.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate enhancement New feature/addition

Projects

None yet

Development

Successfully merging this pull request may close these issues.

re-export arrow::util rand version, breaking downstreams on a different rand major

3 participants