Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
8 changes: 7 additions & 1 deletion datafusion/expr/src/logical_plan/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2831,12 +2831,18 @@ impl Filter {
/// Create a new filter operator.
///
/// Skips the type-checking, window function check and dealiasing done in
/// [Self::try_new]. For internal use in DataFusion only.
/// [Self::try_new].
///
/// **Preconditions:**
/// - the `predicate` expression returns a boolean value
/// - the `predicate` expression is not aliased
/// - the `predicate` expression contains no window function calls
///
/// # Public Only for Internal Use:

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.

in fact the comment above says "for internal use in Datafusion only"

///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn new(predicate: Expr, input: Arc<LogicalPlan>) -> Self {
Self { predicate, input }
Expand Down
7 changes: 5 additions & 2 deletions datafusion/physical-expr-common/src/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,11 @@ pub fn compile_regex(
/// compiles a single pattern up front, before it reads any value, takes
/// `None`: it compiles that pattern whatever the values are.
///
/// This is `pub` only so that the crates that call the kernels can reach it.
// Not public API.
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn explain_regexp_kernel_error(
function_name: &str,
Expand Down
10 changes: 10 additions & 0 deletions datafusion/physical-expr/src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ impl AggregateExprBuilder {
self
}

/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn human_display_alias(mut self, alias: impl Into<String>) -> Self {
let alias = alias.into();
Expand Down Expand Up @@ -696,6 +701,11 @@ impl AggregateFunctionExpr {
.map(AggregateHumanDisplay::expression)
}

/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn human_display_alias(&self) -> Option<&str> {
self.human_display
Expand Down
19 changes: 17 additions & 2 deletions datafusion/physical-plan/src/aggregates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,9 @@ impl AggregateExec {
///
/// # Public Only for Internal Use:
///
/// This is not part of the supported public API, it's made public for internal
/// optimizer usage.
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
///
/// # TopK Optimization Overview
///
Expand Down Expand Up @@ -1141,6 +1142,13 @@ impl AggregateExec {
/// leaves the aggregate in a consistent state. Ineligible aggregates return
/// `None`. Eligible aggregates are returned unchanged when the limit is zero
/// or no tighter than the existing limit.
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn try_optimize_distinct_soft_limit(
mut self,
limit: usize,
Expand All @@ -1166,6 +1174,13 @@ impl AggregateExec {
///
/// The caller must preserve the schema, filters, and ordering requirements.
/// Changing expressions in a TopK aggregate drops its specialization.
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn with_new_aggr_exprs(
&self,
aggr_expr: impl Into<Arc<[Arc<AggregateFunctionExpr>]>>,
Expand Down
6 changes: 6 additions & 0 deletions datafusion/physical-plan/src/distribution_requirements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ impl InputDistributionRequirements {
/// Independent per-child requirements are intentionally ignored here, use
/// [`Self::child_satisfaction`] for those checks. An empty result means all
/// co-partitioning requirements are satisfied.
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn unsatisfied_co_partitioned_children(
&self,
Expand Down
13 changes: 13 additions & 0 deletions datafusion/physical-plan/src/joins/cross_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,19 @@ impl CrossJoinExec {
/// This function should be called BEFORE inserting any repartitioning
/// operators on the join's children. Check [`super::HashJoinExec::swap_inputs`]
/// for more details.
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// Direct use of this API in downstream projects is discouraged because
/// correctness depends on strict preconditions. See the notes above for
/// correct usage.
///
/// This API may change frequently as internal join optimizations evolve.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn swap_inputs(&self) -> Result<Arc<dyn ExecutionPlan>> {
let new_join =
CrossJoinExec::new(Arc::clone(&self.right), Arc::clone(&self.left));
Expand Down
13 changes: 13 additions & 0 deletions datafusion/physical-plan/src/joins/hash_join/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1408,6 +1408,19 @@ impl HashJoinExec {
/// physical optimizer rule to determine a good join order, which is
/// executed before the `EnforceDistribution` rule (the rule that may
/// insert `RepartitionExec` operators).
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// Direct use of this API in downstream projects is discouraged because
/// correctness depends on strict preconditions. See the notes above for
/// correct usage.
///
/// This API may change frequently as internal join optimizations evolve.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]

@2010YOUY01 2010YOUY01 Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This API seem like reasonable to be public, however now it requires cooperation from several other optimizer rules, to make it safe. The comments right above can demonstrate it is tricky to use.

Note downstreams can still have access to it, this marker is only a hint for (a) might change often (b) tricky to use it correctly, as explained in the link

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.

This one in particular I would like to maybe add a comment about "might change" or "is tricky to use" if posisble to make it easier to understand the internal marking

pub fn swap_inputs(
&self,
partition_mode: PartitionMode,
Expand Down
9 changes: 7 additions & 2 deletions datafusion/physical-plan/src/joins/join_hash_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,16 @@ use hashbrown::hash_table::Entry::{Occupied, Vacant};
/// At runtime we choose between using `JoinHashMapU32` and `JoinHashMapU64` which oth implement
/// `JoinHashMapType`.
///
/// ## Note on use of this trait as a public API
/// This is currently a public trait but is mainly intended for internal use within DataFusion.
/// For example, we may compare references to `JoinHashMapType` implementations by pointer equality
/// rather than deep equality of contents, as deep equality would be expensive and in our usage
/// patterns it is impossible for two different hash maps to have identical contents in a practical sense.
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub trait JoinHashMapType: Send + Sync {
fn extend_zero(&mut self, len: usize);

Expand Down
7 changes: 7 additions & 0 deletions datafusion/physical-plan/src/joins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ use utils::JoinHashMapType;
/// contains rows.
///
/// [`NullEquality::NullEqualsNothing`]: datafusion_common::NullEquality::NullEqualsNothing
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub enum Map {
HashMap(Box<dyn JoinHashMapType>),
ArrayMap(ArrayMap),
Expand Down
13 changes: 13 additions & 0 deletions datafusion/physical-plan/src/joins/nested_loop_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,19 @@ impl NestedLoopJoinExec {
/// This function should be called BEFORE inserting any repartitioning
/// operators on the join's children. Check [`super::HashJoinExec::swap_inputs`]
/// for more details.
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// Direct use of this API in downstream projects is discouraged because
/// correctness depends on strict preconditions. See the notes above for
/// correct usage.
///
/// This API may change frequently as internal join optimizations evolve.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn swap_inputs(&self) -> Result<Arc<dyn ExecutionPlan>> {
let left = self.left();
let right = self.right();
Expand Down
13 changes: 13 additions & 0 deletions datafusion/physical-plan/src/joins/sort_merge_join/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,19 @@ impl SortMergeJoinExec {
/// This function should be called BEFORE inserting any repartitioning
/// operators on the join's children. Check [`super::super::HashJoinExec::swap_inputs`]
/// for more details.
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// Direct use of this API in downstream projects is discouraged because
/// correctness depends on strict preconditions. See the notes above for
/// correct usage.
///
/// This API may change frequently as internal join optimizations evolve.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn swap_inputs(&self) -> Result<Arc<dyn ExecutionPlan>> {
let left = self.left();
let right = self.right();
Expand Down
7 changes: 7 additions & 0 deletions datafusion/physical-plan/src/joins/symmetric_hash_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,13 @@ impl SymmetricHashJoinExec {
}

/// Check if order information covers every column in the filter expression.
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn check_if_order_information_available(&self) -> Result<bool> {
if let Some(filter) = self.filter() {
let left = self.left();
Expand Down
7 changes: 7 additions & 0 deletions datafusion/physical-plan/src/joins/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ use crate::{
};
// compatibility
pub use super::join_filter::JoinFilter;
///
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub use super::join_hash_map::JoinHashMapType;
pub use crate::joins::{JoinOn, JoinOnRef};

Expand Down
16 changes: 10 additions & 6 deletions datafusion/physical-plan/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ use crate::ExecutionPlan;
/// Implemented by `datafusion-proto`. Plan authors never name this trait; they
/// call methods on [`ExecutionPlanEncodeCtx`] instead.
///
/// **Not public API.** `pub` only because the implementors live in another
/// crate; `#[doc(hidden)]` records that, so encoding primitives can be added
/// here as the serialization hooks grow without breaking downstream code.
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub trait ExecutionPlanEncode {
/// Serialize a child execution plan (recursing through the central
Expand Down Expand Up @@ -111,9 +113,11 @@ pub trait ExecutionPlanEncode {
/// Implemented by `datafusion-proto`. Plan authors never name this trait; they
/// call methods on [`ExecutionPlanDecodeCtx`] instead.
///
/// **Not public API.** `pub` only because the implementors live in another
/// crate; `#[doc(hidden)]` records that, so decoding primitives can be added
/// here as the serialization hooks grow without breaking downstream code.
/// # Public Only for Internal Use:
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub trait ExecutionPlanDecode {
/// Deserialize a child execution plan (recursing through the central
Expand Down
12 changes: 6 additions & 6 deletions docs/source/contributor-guide/api-health.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ Do not expose internal APIs solely for tests or microbenchmarks. Some legacy cod
does so, but new tests and benchmarks should exercise observable behavior to
simplify maintenance.

For APIs intended only for internal use, add `#[doc(hidden)]` and a doc comment
section headed `# Public Only for Internal Use:`. Name the crate or component
that requires access and explain why the API is not intended for downstream use.
For example:
For APIs intended only for internal use, add `#[doc(hidden)]` and use the
following doc comment format, including the API policy link:

```txt
impl HashTableLookupExpr {
/// ...
///
/// # Public Only for Internal Use:
/// `datafusion-proto` tests require this constructor, but it is not part of
/// the supported public API.
///
/// This is not a public API and is for internal use only; see [API policy] for details.
///
/// [API policy]: https://datafusion.apache.org/contributor-guide/api-health.html#internal-public-apis
#[doc(hidden)]
pub fn new(...) {...}
}
Expand Down
Loading