You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: BIT_COUNT truncates FLOAT/DOUBLE columns and returns wrong filter and CTAS results #32506
CREATEDATABASEbitcount_column_compat;
USE bitcount_column_compat;
CREATETABLEnumbers(id INTPRIMARY KEY,d DOUBLE,f FLOAT,e DECIMAL(8,2));
INSERT INTO numbers VALUES
(0,-3.9,-3.9,-3.9),(1,-3.5,-3.5,-3.5),(2,-2.5,-2.5,-2.5),
(3,-0.6,-0.6,-0.6),(4,-0.5,-0.5,-0.5),(5,-0.49,-0.49,-0.49),
(6,0,0,0),(7,0.49,0.49,0.49),(8,0.5,0.5,0.5),
(9,0.6,0.6,0.6),(10,2.5,2.5,2.5),(11,3.5,3.5,3.5),
(12,3.9,3.9,3.9),(13,NULL,NULL,NULL);
SELECT id,d,BIT_COUNT(d),CAST(d AS SIGNED),BIT_COUNT(CAST(d AS SIGNED))
FROM numbers ORDER BY id;
SELECT id FROM numbers WHERE BIT_COUNT(d)=64ORDER BY id;
CREATETABLEsaved_bitsASSELECT id,BIT_COUNT(d) AS n FROM numbers;
SELECT*FROM saved_bits ORDER BY id;
-- FLOAT 同现;DECIMAL 对照正常。SELECT id,BIT_COUNT(f),BIT_COUNT(e) FROM numbers ORDER BY id;
-- 正常常量对照:两端都为2,不应改成1。SELECT BIT_COUNT(CAST(3.9AS DOUBLE));
Actual / expected behavior
完整 14 行 BIT_COUNT(d)(按 id 0..13):
MySQL 8.0.45 / 8.3.0:
62,62,63,64,0,0,0,0,0,1,1,1,1,NULL
MatrixOne, both CNs:
63,63,63,0,0,0,0,0,0,0,1,2,2,NULL
列值
MySQL BIT_COUNT(d)
MO BIT_COUNT(d)
两端显式转 SIGNED 后计数
-0.6
64
0
64
0.6
1
0
1
3.9
1
2
1
WHERE BIT_COUNT(d)=64 在 MySQL 返回 id=3,MO 返回空集。CTAS 读回 saved_bits 保留上述错误计数,因此不是结果元数据或客户端显示差异。
Stability and controls
三轮全新数据库,两个 MO CN、两个 MySQL 版本均重复确认。
FLOAT 同现;DECIMAL、显式 CAST(d AS SIGNED)、整数/NULL 和浮点常量控制正确。
BIT_COUNT(SUM(d) OVER(PARTITION BY id)) 与 AVG 的交叉也复现,每个分区只有一行,排除了聚合顺序不确定性。
Activity
fix: stabilize floating BIT_COUNT conversion across plans and upgrades
fix: stabilize floating BIT_COUNT conversion across plans and upgrades (