Skip to content

docs: Clarify EquivalenceClass, ConstExpr, and OrderingEquivalenceClass docs - #27238

Open
alamb wants to merge 7 commits into
apache:mainfrom
alamb:alamb/equivalence-class-docs
Open

alamb wants to merge 7 commits into
apache:mainfrom
alamb:alamb/equivalence-class-docs

Conversation

@alamb

@alamb alamb commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • N/A, documentation only.

Rationale for this change

While reviewing #27191 I was researching how EquivalenceProperties tracks orderings, equal expressions and constants, and wanted to write down what I learned so others do not have to repeat it.

Several of the struct docs in the equivalence module were out of date or hard to follow. For example, the ConstExpr docs still described across_partitions as a boolean flag.

What changes are included in this PR?

Improve docs

What is the testing strategy for this PR?

CI

Are there any user-facing changes?

No.

…s docs

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions github-actions Bot added the physical-expr Changes to the physical-expr crates label Nov 8, 2026
@alamb alamb added the documentation Improvements or additions to documentation label Nov 8, 2026

/// Represents whether a constant expression's value is uniform or varies across
/// partitions. Has two variants:
/// - `Heterogeneous`: The constant expression may have different values for

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.

I think it is more common to document the field names at their definition site rather than in the module level so I moved them there

/// different partitions.
/// - `Uniform(Option<ScalarValue>)`: The constant expression has the same value
/// across all partitions, or is `None` if the value is unknown.
/// How a constant expression's value varies across partitions.

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.

I also tried to make this more concise so it is easier to undersand

/// earlier in the plan, `A` would become a constant in subsequent operations.
///
/// # Fields
/// An expression known to be constant during the execution of a query.

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.

similarly I made this more concise and removed the redundant field level documentation

/// `EquivalenceGroup` supports fast lookups of expressions and their
/// equivalence classes. See [`EquivalenceProperties`] for more details.
///
/// [`EquivalenceProperties`]: crate::equivalence::EquivalenceProperties

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.

I am trying to route all docs back to EquivalenceProperties where we can centralize as much as possible

/// [`GroupingEquivalenceClass`] is used when groups of equal values are
/// contiguous, but not in order.
///
/// An `OrderingEquivalenceClass` is a set of such equivalent orderings, which

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 describes how the data is represented and invariants (which is an implementation detail) -- moved to the field definition

/// `[k, w]` once for each of the four directions of `w`.
///
/// ### Future Improvements
/// This is how a whole-partition window aggregate records that its value

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.

I found the existing documentation quite hard to understand about whole-partition window aggregates, etc. more coming soon

Co-authored-by: xavlee <52435309+xavlee@users.noreply.github.com>
@github-actions github-actions Bot removed the documentation Improvements or additions to documentation label Nov 9, 2026

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

@alamb thanks for writing this down. The clippy failure blocks the merge queue; it's a one-line fix, details inline.

@alamb
alamb requested a review from jayzhan211 November 11, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants