Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
No issue was found for CONV() dispatching fixed-width values to its string executor. #28392 covers numeric-prefix parsing after a valid string argument has already reached CONV().
Branch Name
main
Commit ID
a9d3b8b857c44f1249e682c91d4d62a914eb7d20
Other Environment Information
- Local standalone MatrixOne built from the commit above on macOS arm64
- Reference: MySQL 8.3.0
Actual Behavior
CONV() accepts any first-argument type during function binding, but its executor handles only character, integer, unsigned integer, and FLOAT/DOUBLE vectors explicitly. DECIMAL, BOOL, and temporal vectors fall through to convString, which interprets fixed-width vector storage as varlena and raises an internal panic:
SELECT CONV(CAST(15.5 AS DECIMAL(4,1)),10,16);
SELECT CONV(TRUE,10,16);
SELECT CONV(DATE '2024-05-06',10,16);
SELECT CONV(CAST('2024-05-06 12:34:56' AS DATETIME),10,16);
SELECT CONV(CAST('12:34:56' AS TIME),10,16);Each statement returns error 20101 beginning with:
internal error: panic unsafe slice cast ...
and exposes a Go stack rooted at:
GenerateFunctionStrParameter
convString
Conv
MySQL 8.3 returns, respectively, F, 1, 7E8, 7E8, and C.
All five constant forms and DECIMAL/BOOL/DATE/DATETIME/TIME column forms were repeated three times. Constants panic during constant folding; columns panic during pipeline execution. A SELECT 1 health check succeeds after every group, so the process and connection remain available.
The prepared-marker path has the related type-loss form rather than a panic:
PREPARE s FROM 'SELECT CONV(?,10,16)';
SET @v=TRUE;
EXECUTE s USING @v;
-- MatrixOne: 0
-- MySQL: 1Expected Behavior
The binder and executor must agree on the permitted first-argument types. MySQL-compatible numeric/temporal values should be converted without an internal error; unsupported types must be cast explicitly or rejected before execution rather than being passed to a string-vector accessor.
Steps to Reproduce
CREATE DATABASE codex_conv_types;
USE codex_conv_types;
CREATE TABLE t(
id INT PRIMARY KEY,
d DECIMAL(6,2), b BOOLEAN, dt DATE, dtt DATETIME, tm TIME
);
INSERT INTO t VALUES
(1,15.5,TRUE,'2024-05-06','2024-05-06 12:34:56','12:34:56'),
(2,NULL,NULL,NULL,NULL,NULL);
SELECT id,CONV(d,10,16) FROM t ORDER BY id;
SELECT id,CONV(b,10,16) FROM t ORDER BY id;
SELECT id,CONV(dt,10,16) FROM t ORDER BY id;
SELECT id,CONV(dtt,10,16) FROM t ORDER BY id;
SELECT id,CONV(tm,10,16) FROM t ORDER BY id;Controls
- Integer, unsigned integer, FLOAT/DOUBLE, and string input paths remain usable.
CONV(CAST(dt AS CHAR),10,16)andCONV(YEAR(dt),10,16)return7E8in both engines.- NULL propagation is correct after a supported argument reaches the executor.
- The same MatrixOne instance remains healthy after the error.
Activity
XuPeng-SH commentedon Sep 11, 2026
Implemented in #28650. CONV now dispatches fixed-width typed vectors safely, supports the required BOOL/DECIMAL/temporal semantics, propagates NULL, and cleanly rejects unsupported JSON/UUID inputs instead of reaching a varlena accessor. The prepared BOOL/DECIMAL/temporal path is covered and the standalone server remained healthy after rejection tests.
fix(function): align CONV and BIN typed dispatch (#28650)
Ariznawlll commentedon Sep 12, 2026
已在最新官方 main
efb2c5084957ac90273a3f625668fc6a784562c4验证。DECIMAL、BOOL、DATE、DATETIME、TIME 进入CONV/BIN不再走错误的convString路径或 panic。15.50的CONV(...,10,16)为F,BOOL/时态的 BIN/CONV 均可执行。issue_28210_28211_28392_28454_28456_28460_28461_functions;三轮复跑 12/12 case、252/252 statements 一致通过。测试通过。
fix(function): align CONV and BIN typed dispatch (matrixorigin#28650)
fix(function): align CONV and BIN typed dispatch (matrixorigin#28650)
fix(function): align CONV and BIN typed dispatch (matrixorigin#28650)