Repository navigation
Description
Is there an existing issue for the same bug?
-
I have checked the existing issues.
-
[Bug]: EXPORT_SET raises an internal error for an INT number_of_bits column #28210 concerns an INT
number_of_bitscolumn. -
[Bug]: EXPORT_SET changes zero and negative bit counts to one #28211 concerns zero/negative
number_of_bitsboundaries. -
[Bug]: MAKE_SET interprets DECIMAL storage as an unscaled bit mask #28399 covers DECIMAL handling in
MAKE_SET.
No existing issue covers the first bits argument of EXPORT_SET().
Branch Name
main
Commit ID
a9d3b8b857c44f1249e682c91d4d62a914eb7d20
Other Environment Information
- Local standalone MatrixOne built from the commit above
- Reference: MySQL 8.3.0
Actual Behavior
EXPORT_SET(bits, ...) uses different and incorrect conversions for DECIMAL, FLOAT/DOUBLE, BOOL, and prepared values.
DECIMAL storage is used as an unscaled bit mask
SELECT
EXPORT_SET(CAST(1.4 AS DECIMAL(4,1)),'Y','N','',4),
EXPORT_SET(CAST(1.40 AS DECIMAL(4,2)),'Y','N','',4),
EXPORT_SET(CAST(1.400 AS DECIMAL(5,3)),'Y','N','',4);MatrixOne: NYYY, NNYY, NNNY
MySQL: YNNN, YNNN, YNNN
The MatrixOne results correspond to masks 14, 140, and 1400: the stored DECIMAL coefficients. Merely changing scale changes the selected bits.
FLOAT/DOUBLE values are truncated instead of rounded
For DOUBLE values 1.4, 1.5, 1.9, and -1.5, MatrixOne uses masks 1, 1, 1, and -1. MySQL uses 1, 2, 2, and -2. This changes both positive and negative selected-bit results.
Boolean inputs are rejected
EXPORT_SET(TRUE,'Y','N','',4) is rejected with invalid argument function export_set; MySQL returns YNNN.
Prepared values lose their numeric category
With a fresh server-side statement on every run, DECIMAL/DOUBLE 1.5 produces YNNN in MatrixOne and NYNN in MySQL. TRUE produces NNNN in MatrixOne and YNNN in MySQL.
All scalar, column, CTAS, and prepared forms were reproduced three times.
The executor confirms the observed split:
- FLOAT/DOUBLE getters call
int64(val), which truncates. - Other accepted numeric types fall through to
GenerateFunctionFixedTypeParameter[int64]; DECIMAL storage is then read without applying its scale. - The checker has no accepted Boolean numeric path.
Expected Behavior
The first bits argument should be converted to an integer numeric value before bit inspection. Equivalent DECIMAL values must be scale-invariant, fractional numeric values must follow MySQL's rounding rule for this argument, and Boolean values must map to 0/1.
Steps to Reproduce
CREATE DATABASE codex_export_set_bits;
USE codex_export_set_bits;
CREATE TABLE t(
id INT PRIMARY KEY,
d1 DECIMAL(4,1),
d2 DECIMAL(5,2),
f DOUBLE,
b BOOLEAN
);
INSERT INTO t VALUES
(1,1.4,1.40,1.4,TRUE),
(2,1.5,1.50,1.5,FALSE),
(3,1.9,1.90,1.9,NULL),
(4,-1.5,-1.50,-1.5,NULL);
SELECT id,EXPORT_SET(d1,'Y','N','',4) FROM t ORDER BY id;
SELECT id,EXPORT_SET(d2,'Y','N','',4) FROM t ORDER BY id;
SELECT id,EXPORT_SET(f,'Y','N','',4) FROM t ORDER BY id;
SELECT id,EXPORT_SET(b,'Y','N','',4) FROM t ORDER BY id;Controls
- Integer masks 0, 1, 2, 3, and -1 agree with MySQL.
- NULL propagation remains correct.
number_of_bitsbehavior is not part of this issue and remains tracked by [Bug]: EXPORT_SET raises an internal error for an INT number_of_bits column #28210/[Bug]: EXPORT_SET changes zero and negative bit counts to one #28211.
Activity
refactor(sql): migrate bit-pattern integer parameters (#29231)
slyunnn commentedon Sep 29, 2026
Regression and extended verification for #28463 (2026-09-29)
Verification Environment
origin/mainatb9013dc6bb058ec74935a62ac3a35f57d13c2f98—Fix replay promotion CI regressions on main (#29426).matrixorigin/matrixone:localimage was rebuilt from the exactorigin/mainsource archive and all verification containers were recreated from that image.2 CN / 1 TN / 1 Log service / Proxy.6001, CN116001, and CN216002; all three accepted TCP connections and completed the reported SQL. The original scenario was executed through each endpoint, not inferred from a health check.database/sqlwithgo-sql-driver/mysqlandinterpolateParams=falsefor binary prepared statements (COM_STMT_PREPARE/COM_STMT_EXECUTE).8.3.0executed the original column scenario and returned the same rows as MatrixOne.What Was Covered
DECIMAL(4,1),DECIMAL(5,2), andDECIMAL(5,3)scale-invariance scenario:1.4,1.40, and1.400all returnedYNNNthrough Proxy, CN1, and CN2.DOUBLEcolumn scenario:1.4,1.5,1.9, and-1.5returned the expected masksYNNN,NYNN,NYNN, andNYYYon all three endpoints.BOOLEANcolumn scenario:TRUEreturnedYNNN,FALSEreturnedNNNN, andNULLpropagated asNULLon all three endpoints.2.5, signed-2,UINT64maximum,BIT(64), andNULLproduced the expected bit masks.IFandCASEexpressions withDECIMALandDOUBLEinputs preserved the expected masks.PREPAREtemplate handled approximate1.5, exact2.5, string1.5, andTRUEcorrectly through Proxy, CN1, and CN2.database/sql+go-sql-driver/mysqlwithinterpolateParams=falsereturnedNYNNforfloat64(1.5),YNNNfortrue, andYNNNforCAST(? AS DECIMAL(10,2))with1.40through all three endpoints.EXPORT_SET(CAST('9223372036854775808' AS DECIMAL(20,0)), ...)was rejected on all three endpoints withERROR 1690/22003(data out of range).8.3.0returned the same original four-rowDECIMAL/DOUBLE/BOOLEANresult matrix.Findings
3f0a68bd8034d37e098765920f328985c308c9ff—refactor(sql): migrate bit-pattern integer parameters (#29231), merged by #29231. It centralizes type-domain coercion for bit-pattern integer parameters, includingEXPORT_SET.DECIMAL, truncatedDOUBLE, rejectedBOOLEAN, and prepared-value category-loss behaviors were not reproduced.MOTR / BVT Coverage
test/distributed/cases/function/bit_integer_parameter_coercion.sqland its result file. It covers the reportedDECIMAL,DOUBLE,BOOLEAN,NULL, signed/unsigned boundaries, SQL prepared reuse, and generated-expression cases.Final Conclusion
Fixed. The reported
EXPORT_SETtype-coercion contract is verified on the latestorigin/mainruntime through Proxy6001, CN116001, and CN216002, including real binary prepared-statement execution and a MySQL8.3.0compatibility control. Large-data regression is not required for the reasons above.