You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "geoffreyclaude (via GitHub)" <gi...@apache.org> on 2026/10/06 22:49:14 UTC

[PR] fix: Return NULL for empty BIT_XOR sliding windows [datafusion]

geoffreyclaude opened a new pull request, #26095:
URL: https://github.com/apache/datafusion/pull/26095

   ## Which issue does this PR close?
   
   No existing issue. The SQL regression below reproduces the bug on current main.
   
   ## Rationale for this change
   
   BIT_XOR returns 0 instead of NULL after the last non-null value leaves a sliding window. For values 7, NULL, 9, a window containing only the preceding row produces NULL, 7, 0; the correct results are NULL, 7, NULL.
   
   ```sql
   SELECT id,
          bit_xor(v) OVER (
              ORDER BY id ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING
          ) AS x
   FROM (VALUES (1, CAST(7 AS BIGINT)),
                (2, CAST(NULL AS BIGINT)),
                (3, CAST(9 AS BIGINT))) AS t(id, v)
   ORDER BY id;
   ```
   
   ## What changes are included in this PR?
   
   Add a sliding BIT_XOR accumulator that tracks the remaining non-null count alongside the XOR value. This distinguishes an empty aggregate from a nonempty aggregate whose values cancel to zero.
   
   The sliding factory supplies this accumulator. The ordinary accumulator no longer advertises retraction support. Ordinary scalar and grouped aggregation retain their existing one-field state and groups implementation.
   
   ## What is the testing strategy for this PR?
   
   The public-factory regression fails on unmodified main and passes with the fix. Six focused tests cover removing the final non-null value, valid zero, empty-state reuse, merged intermediate counts, and ordinary/DISTINCT state and capabilities.
   
   The new bit_xor_sliding_window.slt exercises all eight integer types across batch-size-2 boundaries, empty and all-null frames, ordinary GROUP BY, and existing DISTINCT/Null-input behavior.
   
   Passed:
   
   - `cargo fmt --all`
   - `cargo clippy --all-targets --all-features -- -D warnings`
   - The extended workspace test command from `AGENTS.md`: 12,449 Rust tests passed, 8 existing tests ignored, and all 528 SQL files completed, including all 125 extended fuzz cases.
   - `./dev/rust_lint.sh`, including its Clippy feature set, generated docs, license checks, dependency checks, Rustdoc with warnings denied, and the HTML documentation build.
   
   The extended test run used a subprocess open-file limit of 65,536. At the environment's default limit of 1,024, an unrelated sort spill test hit `Too many open files`; that same unchanged test and the complete suite passed with the raised limit.
   
   ## Are there any user-facing changes?
   
   Sliding BIT_XOR windows return NULL after all non-null inputs leave. Callers that need retraction should request the sliding accumulator; the ordinary factory reports that it does not support retraction.
   


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: Return NULL for empty BIT_XOR sliding windows [datafusion]

Posted by "geoffreyclaude (via GitHub)" <gi...@apache.org>.
geoffreyclaude closed pull request #26095: fix: Return NULL for empty BIT_XOR sliding windows
URL: https://github.com/apache/datafusion/pull/26095


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: Return NULL for empty BIT_XOR sliding windows [datafusion]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #26095:
URL: https://github.com/apache/datafusion/pull/26095#issuecomment-6027112989

   ## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/26095?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `71.63462%` with `59 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 82.71%. Comparing base ([`db83fcc`](https://app.codecov.io/gh/apache/datafusion/commit/db83fccb9ac10f843be04daa5826501d2338caf4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`fa7cdd8`](https://app.codecov.io/gh/apache/datafusion/commit/fa7cdd88f7cb85ba1bb98f8b6c4eb29b2c3a954e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/datafusion/pull/26095?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [...tafusion/functions-aggregate/src/bit\_and\_or\_xor.rs](https://app.codecov.io/gh/apache/datafusion/pull/26095?src=pr&el=tree&filepath=datafusion%2Ffunctions-aggregate%2Fsrc%2Fbit_and_or_xor.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZGF0YWZ1c2lvbi9mdW5jdGlvbnMtYWdncmVnYXRlL3NyYy9iaXRfYW5kX29yX3hvci5ycw==) | 71.63% | [6 Missing and 53 partials :warning: ](https://app.codecov.io/gh/apache/datafusion/pull/26095?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##             main   #26095      +/-   ##
   ==========================================
   - Coverage   82.72%   82.71%   -0.01%     
   ==========================================
     Files        1147     1147              
     Lines      448179   448380     +201     
     Branches   448179   448380     +201     
   ==========================================
   + Hits       370754   370890     +136     
   - Misses      54895    54906      +11     
   - Partials    22530    22584      +54     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/26095?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] fix: Return NULL for empty BIT_XOR sliding windows [datafusion]

Posted by "geoffreyclaude (via GitHub)" <gi...@apache.org>.
geoffreyclaude commented on PR #26095:
URL: https://github.com/apache/datafusion/pull/26095#issuecomment-6351637215

   Closing as a duplicate of #26485, which has been merged and fixes the same BIT_XOR sliding-window NULL handling issue.


-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org