Skip to content

refactor: replace normalize_float_scalar with ScalarValue::normalize - #26727

Open
mkleen wants to merge 2 commits into
apache:mainfrom
mkleen:scalar-value-normalize
Open

mkleen wants to merge 2 commits into
apache:mainfrom
mkleen:scalar-value-normalize

Conversation

@mkleen

@mkleen mkleen commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

#26595 added a helper that turns -0.0 into 0.0 in a single value. It works on a ScalarValue, so it makes more sense as a method on ScalarValue.

What changes are included in this PR?

  • The helper is now a method: ScalarValue::normalize().
  • The old function normalize_float_scalar is removed, and the code that used it now calls the new method.

What is the testing strategy for this PR?

The existing test was moved along with the helper. Nothing else changes, so the existing tests still apply.

Are there any user-facing changes?

This PR Moves the scalar `-0.0` normalization from a free
function in `datafusion_common::float_semantics` to a method on
`ScalarValue`. `normalize_float_scalar` was added in apache#26595 and
has not been released, so it is removed rather than deprecated.
The deprecated `utils::normalize_float_zero_scalar` now points
to `ScalarValue::normalize`.
@github-actions github-actions Bot added physical-expr Changes to the physical-expr crates optimizer Optimizer rules common Related to common crate labels Oct 25, 2026
@github-actions

github-actions Bot commented Oct 25, 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 fb7cf8e832bec8c09938a21ac09acd08a81df38c
    Building datafusion-common v55.1.0 (current)
       Built [  39.106s] (current)
     Parsing datafusion-common v55.1.0 (current)
      Parsed [   0.081s] (current)
    Building datafusion-common v55.1.0 (baseline)
       Built [   1.284s] (baseline)
     Parsing datafusion-common v55.1.0 (baseline)
      Parsed [   0.080s] (baseline)
    Checking datafusion-common v55.1.0 -> v55.1.0 (no change; assume patch)
     Checked [   0.761s] 229 checks: 228 pass, 1 fail, 0 warn, 31 skip

--- failure function_missing: pub fn removed or renamed ---

Description:
A publicly-visible function cannot be imported by its prior path. A `pub use` may have been removed, or the function itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.51.0/src/lints/function_missing.ron

Failed in:
  function datafusion_common::float_semantics::normalize_float_scalar, previously in file /home/runner/work/datafusion/datafusion/target/semver-checks-shared/semver-checks/git-fb7cf8e832bec8c09938a21ac09acd08a81df38c/2b67194e2d4a16b8e6d790baacc6ebb9a5dc994a/datafusion/common/src/float_semantics.rs:184

     Summary semver requires new major version: 1 major and 0 minor checks failed
    Finished [  42.954s] datafusion-common
    Building datafusion-optimizer v55.1.0 (current)
       Built [  20.693s] (current)
     Parsing datafusion-optimizer v55.1.0 (current)
      Parsed [   0.037s] (current)
    Building datafusion-optimizer v55.1.0 (baseline)
       Built [   7.917s] (baseline)
     Parsing datafusion-optimizer v55.1.0 (baseline)
      Parsed [   0.038s] (baseline)
    Checking datafusion-optimizer v55.1.0 -> v55.1.0 (no change; assume patch)
     Checked [   0.180s] 229 checks: 229 pass, 31 skip
     Summary no semver update required
    Finished [  29.757s] datafusion-optimizer
    Building datafusion-physical-expr v55.1.0 (current)
       Built [  13.347s] (current)
     Parsing datafusion-physical-expr v55.1.0 (current)
      Parsed [   0.058s] (current)
    Building datafusion-physical-expr v55.1.0 (baseline)
       Built [   9.637s] (baseline)
     Parsing datafusion-physical-expr v55.1.0 (baseline)
      Parsed [   0.063s] (baseline)
    Checking datafusion-physical-expr v55.1.0 -> v55.1.0 (no change; assume patch)
     Checked [   0.394s] 229 checks: 229 pass, 31 skip
     Summary no semver update required
    Finished [  24.584s] datafusion-physical-expr
    Building datafusion-physical-expr-common v55.1.0 (current)
       Built [   9.391s] (current)
     Parsing datafusion-physical-expr-common v55.1.0 (current)
      Parsed [   0.022s] (current)
    Building datafusion-physical-expr-common v55.1.0 (baseline)
       Built [   5.619s] (baseline)
     Parsing datafusion-physical-expr-common v55.1.0 (baseline)
      Parsed [   0.023s] (baseline)
    Checking datafusion-physical-expr-common v55.1.0 -> v55.1.0 (no change; assume patch)
     Checked [   0.232s] 229 checks: 229 pass, 31 skip
     Summary no semver update required
    Finished [  16.030s] datafusion-physical-expr-common

@github-actions github-actions Bot added the auto detected api change Auto detected API change label Oct 25, 2026
@mkleen
mkleen marked this pull request as ready for review October 25, 2026 01:37

@kumarUjjawal kumarUjjawal 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 @mkleen

Looks good 👍

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 common Related to common crate optimizer Optimizer rules physical-expr Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants