Skip to content

[pull] main from apache:main - #269

Merged
pull[bot] merged 4 commits into
buraksenn:mainfrom
apache:main
Jun 10, 2026
Merged

pull[bot] merged 4 commits into
buraksenn:mainfrom
apache:main

Conversation

@pull

@pull pull Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

lyne7-sc and others added 4 commits June 9, 2026 19:36
…#22727)

## 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 #123` indicates that this PR will close issue #123.
-->

- Closes #22726.

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

The regex simplification rule rewrites anchored regex matches
(`^literal$`, `^(a|b)$`) into cheaper `=` / `IN` / `LIKE` expressions.
Two bugs in that path:

1. The literal was always built as `Utf8` via `lit(...)`, so on a
`Utf8View` / `LargeUtf8` column the rewritten comparison failed at
execution with `Invalid comparison operation: Utf8View == Utf8`.
2. A `~*` (case-insensitive) anchored literal was rewritten to a
case-sensitive `=`, silently dropping rows that differ only in case.

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

- Build the extracted literal with `string_scalar.to_expr(...)` so its
type follows the column type (`Utf8` / `LargeUtf8` / `Utf8View`),
consistent with the existing `LIKE` branches.
- Rewrite `~*` anchored literals to `ILIKE` instead of `=`. The existing
`is_safe_for_like` guard ensures the literal has no `%` / `_`, so this
is an exact case-insensitive match. (Anchored alternations under `~*`
still fall back to regex evaluation.)

## Are these changes tested?

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

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

Yes. `predicates.slt` now covers anchored `~` / `~*`, single literals
and alternations, over both `Utf8` and `Utf8View` columns. Existing
`regex.rs` unit tests still pass.

## Are there any user-facing changes?

Yes, bug fixes only

<!--
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.
-->
## 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 #123` indicates that this PR will close issue #123.
-->

- Closes #22826 .
- Closes #22490
- Closes #11108 

## Rationale for this change
  
SQL (per PG and IEEE 754) treats `+0.0` and `-0.0` as equal in `=`, `IS
DISTINCT FROM`, DISTINCT, GROUP BY, UNION/INTERSECT/EXCEPT, equi-joins,
and `array_*` set ops. DataFusion treated them as
  distinct because:

- Arrow's `cmp::eq`/`gt`/`lt` use IEEE 754 totalOrder for floats —
`arrow-ord-58.3.0/src/cmp.rs:71-75` explicitly says *"please normalize
zeros before calling this kernel"*.
- Arrow's `RowConverter` row-encodes floats with totalOrder; ±0 produce
different bytes.
- DataFusion's primitive float hashing used raw `to_bits()` /
`to_ne_bytes()`, so ±0 hashed to different buckets.

  ## What changes are included in this PR?

  **Helper** in `datafusion/common/src/utils/mod.rs`:
- `normalize_float_zero(&ArrayRef) -> ArrayRef` — rewrites `-0.0 → +0.0`
for Float16/32/64 via `PrimitiveArray::unary`; `Arc::clone` for
non-float. NaN payloads preserved (`bits << 1 == 0` matches only
  ±0).
- `normalize_float_zero_scalar(ScalarValue) -> ScalarValue` — symmetric
for scalars.

**Applied at six boundary sites** where DataFusion hands float data to
Arrow:
  | Site | Fixes |
  |---|---|
| `physical-expr-common/src/datum.rs::apply_cmp` | BinaryExpr `=`, `<`,
`>`, `IS DISTINCT FROM` |
| `physical-plan/src/joins/utils.rs::eq_dyn_null` | HashJoin row
equality → INNER JOIN, INTERSECT, EXCEPT |
| `physical-plan/src/aggregates/group_values/row.rs::intern` |
Multi-column row-encoded GROUP BY |
| `functions-nested/src/set_ops.rs::general_array_distinct` |
`array_distinct` |
| `functions-nested/src/set_ops.rs::generic_set_lists` | `array_union`,
`array_intersect` |
  | `functions-nested/src/except.rs::general_except` | `array_except` |

  **Float hash macros** normalize for consistency:
- `datafusion/common/src/hash_utils.rs::hash_float_value!` —
`create_hashes`, hash joins, shuffle.
-
`datafusion/physical-plan/src/aggregates/group_values/single_group_by/primitive.rs::hash_float!`
— single-column primitive GROUP BY fast path.

**Single-column primitive GROUP BY / DISTINCT**
(`GroupValuesPrimitive::intern`,
`PrimitiveGroupValueBuilder::{append_val,vectorized_append,equal_to,vectorized_equal_to_*}`)
canonicalize the input via
a new default-identity `canonicalize` method on the local `HashValue`
trait (float override only). Trait visibility lifted to `pub` so the
multi-column file can use it.
## Which issue does this PR close?

- Part of  #22765
- Related to #19783.


## Rationale for this change

While reviewing #22766 from
@comphead I noticed that the release management guide did not point
contributors to the ongoing release tracking issue, where planned
releases are listed.

## What changes are included in this PR?

This PR adds a link to the DataFusion Releases tracking issue from the
release management guide and clarifies that each release is coordinated
in a dedicated GitHub issue.

## Are these changes tested?

Not run. This is a documentation-only change.

## Are there any user-facing changes?

No API or behavior changes. This updates contributor documentation only.
## 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 #123` indicates that this PR will close issue #123.
-->

- Closes #22765 .

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

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

## Are these changes tested?

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

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->

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

---------

Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
@pull pull Bot locked and limited conversation to collaborators Jun 10, 2026
@pull pull Bot added the ⤵️ pull label Jun 10, 2026
@pull
pull Bot merged commit d0ee6b5 into buraksenn:main Jun 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants