Skip to content

[Bug]: BIT_XOR aggregate is rejected with an OVER clause #27342

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

64fa15e

Other Environment Information

- MatrixOne: local single-CN deployment built from the commit above
- MySQL control: MySQL 8.0
- Client: MySQL Connector/J 8.0.33
- Verification: 3 independent rounds

Actual Behavior

MatrixOne accepts BIT_XOR as a grouped aggregate, and accepts BIT_AND and BIT_OR with OVER, but rejects BIT_XOR(...) OVER (...) with SQLState 42000, error 1064.

The MatrixOne parser grammar already declares the BIT_XOR '(' ... ')' window_spec_opt form, so this looks like an incomplete parser/runtime integration rather than an intentionally unsupported syntax.

MySQL result for the same cumulative window query:

1 | 10
2 | 30
3 | 0
4 | 40

Expected Behavior

BIT_XOR should support an OVER clause like the other bitwise aggregate functions and return the cumulative XOR result.

Steps to Reproduce

DROP DATABASE IF EXISTS window_bit_xor_repro;
CREATE DATABASE window_bit_xor_repro;
USE window_bit_xor_repro;

CREATE TABLE t(id INT PRIMARY KEY, v INT);
INSERT INTO t VALUES (1, 10), (2, 20), (3, 30), (4, 40);

-- Control: grouped aggregate is accepted by MatrixOne.
SELECT BIT_XOR(v) FROM t;

-- MatrixOne returns 42000/1064; MySQL returns 10, 30, 0, 40.
SELECT id,
       BIT_XOR(v) OVER (
         ORDER BY id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
       ) AS cumulative_xor
FROM t
ORDER BY id;

Stability, controls, and recovery

  • Reproduced 3/3 on the commit above.
  • MySQL returned the expected result 3/3.
  • BIT_XOR without OVER, and BIT_AND/BIT_OR with OVER, work in MatrixOne.
  • After the syntax error, the same connection and a newly prepared statement remain usable.

Root-cause evidence

pkg/sql/parsers/dialect/mysql/mysql_sql.y contains a BIT_XOR production with window_spec_opt, but the generated parse path rejects the OVER form. The existing aggregate implementation therefore cannot be reached through the declared window syntax.

Suggested regression placement

Add a BVT under test/distributed/cases/window/ covering cumulative, partitioned, empty/all-NULL, and explicit-frame BIT_XOR windows alongside BIT_AND and BIT_OR controls.

Related issues

Activity

  1. added this to the MO-202608 milestone on Aug 19, 2026
  2. added
    kind/bug
    on Aug 19, 2026
  3. added theissue type on Aug 19, 2026
  4. added
    ai-easy
    on Aug 27, 2026
  5. Ariznawlll commented on Aug 28, 2026

    @Ariznawlll
    CollaboratorAuthor

    最新 main 复测 3/3:BIT_XOR cumulative/partition/sliding window 结果正确;空集与 NULL 控制正确;非法列报 1054 后连接可继续查询。稳定 MOTR 已加入 https://github.com/matrixorigin/motr/pull/131,并行三轮通过。无需 big-data、PITR/snapshot、stability 或 chaos。结论:关闭。

  6. Ariznawlll commented on Aug 28, 2026

    @Ariznawlll
    CollaboratorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easykind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions