Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Duplicate
-
12.3.3
-
None
-
Linux/amd64
-
Not for Release Notes
Description
The following table-based case reproduces the issue with MariaDB 12.3.3-MariaDB-ubu2404 on Linux/amd64:
CREATE DATABASE window_bits; |
USE window_bits; |
CREATE TABLE bit_values(v BIGINT UNSIGNED); |
INSERT INTO bit_values VALUES(4294967296); |
SELECT 'minimal' AS phase,BIT_XOR(v) OVER () AS actual,v AS expected FROM bit_values; |
SELECT 'ordinary' AS phase,BIT_XOR(v) AS actual,4294967296 AS expected FROM bit_values; |
SELECT 'controls' AS phase,BIT_OR(v) OVER () AS actual_or,BIT_AND(v) OVER () AS actual_and,v AS expected FROM bit_values; |
DROP DATABASE window_bits; |
SELECT 'cleanup' AS phase,COUNT(*) AS remaining FROM information_schema.SCHEMATA WHERE SCHEMA_NAME='window_bits'; |
The query produces:
phase actual expected
|
minimal 1 4294967296
|
phase actual expected
|
ordinary 4294967296 4294967296
|
phase actual_or actual_and expected
|
controls 4294967296 4294967296 4294967296
|
phase remaining
|
cleanup 0
|
For a window containing the single non-NULL value 4294967296, BIT_XOR(v) OVER () must equal that value. It should therefore return 4294967296, as ordinary BIT_XOR(v) does. The windowed BIT_OR and BIT_AND controls also preserve the full value, while windowed BIT_XOR returns 1.
This occurs when BIT_XOR is used as a window function on BIGINT UNSIGNED values whose significant bits extend beyond 32 bits.
Attachments
Issue Links
- duplicates
-
MDEV-39365 BIT_XOR(v) OVER (...) returns wrong result
-
- In Review
-