Skip to content

docs: Document the convention for internal public APIs - #25495

Merged
2010YOUY01 merged 4 commits into
apache:mainfrom
2010YOUY01:codex/internal-public-api-convention
Sep 22, 2026
Merged

2010YOUY01 merged 4 commits into
apache:mainfrom
2010YOUY01:codex/internal-public-api-convention

Conversation

@2010YOUY01

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

The purpose should be clear from the PR diff itself.

It is an existing convention, this PR document it in API policy.

There are other ~5 places have this pattern, I plan to make a follow-up PR to update their comments.

What changes are included in this PR?

What is the testing strategy for this PR?

Are there any user-facing changes?

@github-actions github-actions Bot added documentation Improvements or additions to documentation physical-plan Changes to the physical-plan crate labels Sep 19, 2026
@github-actions

github-actions Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

Thank you for opening this pull request!

Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch).

Details
     Cloning apache/main
    Building datafusion-physical-plan v55.1.0 (current)
       Built [  40.523s] (current)
     Parsing datafusion-physical-plan v55.1.0 (current)
      Parsed [   0.169s] (current)
    Building datafusion-physical-plan v55.1.0 (baseline)
       Built [  39.692s] (baseline)
     Parsing datafusion-physical-plan v55.1.0 (baseline)
      Parsed [   0.179s] (baseline)
    Checking datafusion-physical-plan v55.1.0 -> v55.1.0 (no change; assume patch)
     Checked [   0.690s] 223 checks: 222 pass, 1 fail, 0 warn, 31 skip

--- failure inherent_method_now_doc_hidden: inherent method #[doc(hidden)] added ---

Description:
A method or associated fn is now #[doc(hidden)], removing it from the crate's public API.
        ref: https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html#hidden
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.50.0/src/lints/inherent_method_now_doc_hidden.ron

Failed in:
  HashTableLookupExpr::new in file /home/runner/work/datafusion/datafusion/target/semver-checks/git-apache_main/fb40c84bec637928a1762fae0ca632ba01c2913e/datafusion/physical-plan/src/joins/hash_join/partitioned_hash_eval.rs:299

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  83.006s] datafusion-physical-plan

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Sep 19, 2026
@codecov-commenter

codecov-commenter commented Sep 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.42%. Comparing base (a522cd5) to head (5c08605).
⚠️ Report is 35 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25495      +/-   ##
==========================================
+ Coverage   82.37%   82.42%   +0.04%     
==========================================
  Files        1138     1139       +1     
  Lines      433506   435372    +1866     
  Branches   433506   435372    +1866     
==========================================
+ Hits       357102   358836    +1734     
+ Misses      54850    54832      -18     
- Partials    21554    21704     +150     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@2010YOUY01
2010YOUY01 requested a review from adriangb September 21, 2026 04:27

@adriangb adriangb 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. I agree documenting an existing convention is a good step.

@alamb do you see any issue with this?

@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.

Thanks @2010YOUY01 and @adriangb -- this makes sense to me

I would personally suggest we try and use a feature for this method rather than not documenting certain methods, but I think this is already an improvement in my mind


### DataFusion-internal Public APIs

Some APIs require `pub` visibility for use across DataFusion crates. Examples

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.

I recommend we also document "why" we have such APIs when so much of DataFusion's flexibility is predicated on extensible APIs.

Maybe the idea is that these APIs are really meant as internal implementation details, but for some logistical reason they have to be in different crates. Thus the "internal" APIs aren't intended as extension points, and may change / etc without warning?

Some APIs require `pub` visibility for use across DataFusion crates. Examples
include:

1. Test helpers.

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.

I think in general multiple types of APIs just makes DataFUsion more complicated and I would like to suggest we minimize the number of such APIs as much as possible

For example, for test helpers, we could potentially use a feature (test_helpers for example) to mark that they are not part of the public API rather than marking them as a doc

}
```

These APIs are hidden from generated documentation and are not considered part

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.

would recommend putting this detail in the intro

@2010YOUY01

Copy link
Copy Markdown
Contributor Author

Thank you for the review @adriangb and @alamb

Thanks @2010YOUY01 and @adriangb -- this makes sense to me

I would personally suggest we try and use a feature for this method rather than not documenting certain methods, but I think this is already an improvement in my mind

I agree using features for test utils is better, and help us exclude one special case

parent-crate (dev-dependencies includes `test_util` feature)
child-crate: with `test_util` feature for public testing APIs

However this might not work well for internal optimizer apis, if a user depends on both parent and child crate, the hidden feature can get implicitly enabled.

To clean up the remaining internal public APIs, I plan to

  • Hide test utilities with a new feature
  • Use the existing approach for others

@2010YOUY01
2010YOUY01 added this pull request to the merge queue Sep 22, 2026
Merged via the queue into apache:main with commit c55319e Sep 22, 2026
42 checks passed
@2010YOUY01
2010YOUY01 deleted the codex/internal-public-api-convention branch September 22, 2026 04:27
notice or a deprecation period. Examples include:

1. Test helpers.
2. Operator APIs required by the optimizer to inspect or rewrite execution plans

@rluvaton rluvaton Sep 22, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: Please add another example - benchmarks, which was the original reason why GroupColumn was exposed and now people use it which complicate changing its api

alamb pushed a commit to alamb/datafusion that referenced this pull request Oct 1, 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. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

- Closes #.

## Rationale for this change

<!--
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.

Please explain the problem you are trying to solve in terms of the
user-visible
behavior, rather than the implementation.

For example, "The code in `foo.rs` doesn't handle nulls" is a symptom of
the
implementation. "COUNT(DISTINCT) returns wrong results when the column
contains
nulls" is the user-visible problem.
-->
See the previous PR for ratioanle
- apache#25495

This PR adds `#[doc(hidden)]` and comments for test-only public APIs

Note in the previous PR we've discussed using feature to hide them, but
I tried and find it hard to maintain
- apache#25678

## What changes are included in this PR?

<!--
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.
-->

## What is the testing strategy for this PR?

<!--
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

Briefly describe how this PR is tested, and point to the specific tests
you added. For example: 'This new feature is covered by the
`sqllogictest` cases added in `foo.slt`'.

If this PR does not add tests, explain why. For example, if the change
is already covered by existing tests, please mention it.

You should also check the `codecov` bot reply on this PR to confirm the
changed code is exercised.
-->

## Are there any user-facing changes?

<!--
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 add the `api
change` label.
-->
IgorOffline pushed a commit to IgorOffline/apache-datafusion that referenced this pull request Oct 10, 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. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

- Closes #.

## Rationale for this change

<!--
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.

Please explain the problem you are trying to solve in terms of the
user-visible
behavior, rather than the implementation.

For example, "The code in `foo.rs` doesn't handle nulls" is a symptom of
the
implementation. "COUNT(DISTINCT) returns wrong results when the column
contains
nulls" is the user-visible problem.
-->
See the previous PR for rationale

- apache#25495

This PR adds #[doc(hidden)] and comments for public APIs that is used as
internal utility.

The major categories are
- already includes `#doc(hidden)`
- Already explained in the comment that this public API is internal-only
- Optimizer utilities, with strict preconditions to use it correctly.

## What changes are included in this PR?

<!--
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.
-->
comments only

## What is the testing strategy for this PR?

<!--
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

Briefly describe how this PR is tested, and point to the specific tests
you added. For example: 'This new feature is covered by the
`sqllogictest` cases added in `foo.slt`'.

If this PR does not add tests, explain why. For example, if the change
is already covered by existing tests, please mention it.

You should also check the `codecov` bot reply on this PR to confirm the
changed code is exercised.
-->

## Are there any user-facing changes?

<!--
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 add the `api
change` label.
-->
Omega359 pushed a commit to Omega359/arrow-datafusion that referenced this pull request Oct 11, 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. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

- Closes #.

## Rationale for this change

<!--
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.

Please explain the problem you are trying to solve in terms of the
user-visible
behavior, rather than the implementation.

For example, "The code in `foo.rs` doesn't handle nulls" is a symptom of
the
implementation. "COUNT(DISTINCT) returns wrong results when the column
contains
nulls" is the user-visible problem.
-->

The purpose should be clear from the PR diff itself.

It is an existing convention, this PR document it in API policy.

There are other ~5 places have this pattern, I plan to make a follow-up
PR to update their comments.

## What changes are included in this PR?

<!--
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.
-->

## What is the testing strategy for this PR?

<!--
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

Briefly describe how this PR is tested, and point to the specific tests
you added. For example: 'This new feature is covered by the
`sqllogictest` cases added in `foo.slt`'.

If this PR does not add tests, explain why. For example, if the change
is already covered by existing tests, please mention it.

You should also check the `codecov` bot reply on this PR to confirm the
changed code is exercised.
-->

## Are there any user-facing changes?

<!--
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 add the `api
change` label.
-->
Omega359 pushed a commit to Omega359/arrow-datafusion that referenced this pull request Oct 11, 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. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

- Closes #.

## Rationale for this change

<!--
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.

Please explain the problem you are trying to solve in terms of the
user-visible
behavior, rather than the implementation.

For example, "The code in `foo.rs` doesn't handle nulls" is a symptom of
the
implementation. "COUNT(DISTINCT) returns wrong results when the column
contains
nulls" is the user-visible problem.
-->
See the previous PR for ratioanle
- apache#25495

This PR adds `#[doc(hidden)]` and comments for test-only public APIs

Note in the previous PR we've discussed using feature to hide them, but
I tried and find it hard to maintain
- apache#25678

## What changes are included in this PR?

<!--
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.
-->

## What is the testing strategy for this PR?

<!--
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

Briefly describe how this PR is tested, and point to the specific tests
you added. For example: 'This new feature is covered by the
`sqllogictest` cases added in `foo.slt`'.

If this PR does not add tests, explain why. For example, if the change
is already covered by existing tests, please mention it.

You should also check the `codecov` bot reply on this PR to confirm the
changed code is exercised.
-->

## Are there any user-facing changes?

<!--
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 add the `api
change` label.
-->
Omega359 pushed a commit to Omega359/arrow-datafusion that referenced this pull request Oct 11, 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. For example
`Closes apache#123` indicates that this PR will close issue apache#123.
-->

- Closes #.

## Rationale for this change

<!--
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.

Please explain the problem you are trying to solve in terms of the
user-visible
behavior, rather than the implementation.

For example, "The code in `foo.rs` doesn't handle nulls" is a symptom of
the
implementation. "COUNT(DISTINCT) returns wrong results when the column
contains
nulls" is the user-visible problem.
-->
See the previous PR for rationale

- apache#25495

This PR adds #[doc(hidden)] and comments for public APIs that is used as
internal utility.

The major categories are
- already includes `#doc(hidden)`
- Already explained in the comment that this public API is internal-only
- Optimizer utilities, with strict preconditions to use it correctly.

## What changes are included in this PR?

<!--
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.
-->
comments only

## What is the testing strategy for this PR?

<!--
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

Briefly describe how this PR is tested, and point to the specific tests
you added. For example: 'This new feature is covered by the
`sqllogictest` cases added in `foo.slt`'.

If this PR does not add tests, explain why. For example, if the change
is already covered by existing tests, please mention it.

You should also check the `codecov` bot reply on this PR to confirm the
changed code is exercised.
-->

## Are there any user-facing changes?

<!--
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 add the `api
change` label.
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto detected api change Auto detected API change documentation Improvements or additions to documentation physical-plan Changes to the physical-plan crate v56.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants