alamb opened a new pull request, #23635:
URL: https://github.com/apache/datafusion/pull/23635
## Which issue does this PR close?
- Related to #23634 (documentation part only; the behavior change is
proposed separately).
## Rationale for this change
While working on #23548 / #23634 we found the existing comments on
`FunctionalDependence::nullable` easy to misread: "whether the source columns
can receive NULL values" suggests the flag tracks *field nullability*, when
what all consumers (`downgrade_dependencies`, `Filter::is_scalar`, and the
`ReplaceDistinctWithAggregate` guard added in #23548) actually rely on is
whether *the same NULL-containing key may occur in multiple rows* (the SQL
`UNIQUE` semantic, where NULLs compare distinct).
That distinction matters: a `GROUP BY` output key can *contain* NULLs, yet
the same key tuple can never *repeat* (grouping treats NULLs as equal), so it
provides primary-key-like guarantees.
## What changes are included in this PR?
Comment-only changes to `datafusion/common/src/functional_dependencies.rs`:
- Document `FunctionalDependence::nullable` in terms of what the flag
guarantees ("NULL keys are exempt from the dependence" vs "every key value,
including NULL, obeys it"), with the `UNIQUE` / `PRIMARY KEY` / `GROUP BY`
examples.
- Convert the inline comments on `Dependency::Single` / `Dependency::Multi`
to doc comments and spell out how each mode interacts with `nullable`, and that
a `Multi` dependence still carries the functional dependence itself (equal keys
agree on dependent columns).
## Are these changes tested?
No code changes; covered by existing tests. `cargo fmt` / `cargo clippy` /
`cargo doc` are clean.
## Are there any user-facing changes?
No behavior changes; improved rustdoc on public items.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]