Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues, including open and closed issues.
Branch Name
main
Commit ID
Other Environment Information
- MatrixOne: locally built from the commit above (
8.0.30-MatrixOne-v1.3.0) - Verification date: 2026-09-10
Actual Behavior
CSV LOAD DATA cannot write any value into a DECIMAL256 target column (DECIMAL precision 39 through 76). It returns an internal error before writing the row:
ERROR 20101 (HY000): internal error: the value type DECIMAL256 is not support now
The failure starts exactly at the Decimal128/Decimal256 boundary:
- The same
LOAD DATA INLINEstatement succeeds forDECIMAL(18,0)andDECIMAL(38,0)and preserves the maximum values exactly. DECIMAL(39,0)fails even for a valid 39-digit value.- A normal
INSERTinto the sameDECIMAL(39,0)table succeeds and preserves the same value exactly. - The wider
DECIMAL(40,0)and scaledDECIMAL(50,10)targets fail through the same CSV load path.
No partial row is written when the error occurs.
Expected Behavior
CSV LOAD DATA should parse and append valid Decimal256 values using the target column's precision and scale, in the same way it already handles Decimal64 and Decimal128.
MatrixOne documents precision 39 through 76 as supported Decimal256 values, and the documented LOAD DATA syntax does not exclude this supported DECIMAL range.
Steps to Reproduce
DROP DATABASE IF EXISTS decimal256_load;
CREATE DATABASE decimal256_load;
USE decimal256_load;
-- Decimal128 boundary control succeeds.
CREATE TABLE d128(id INT PRIMARY KEY, d DECIMAL(38,0));
LOAD DATA INLINE FORMAT='csv',
DATA='1,99999999999999999999999999999999999999\n'
INTO TABLE d128 FIELDS TERMINATED BY ',';
SELECT * FROM d128;
-- Normal Decimal256 write succeeds.
CREATE TABLE d256(id INT PRIMARY KEY, d DECIMAL(39,0));
INSERT INTO d256 VALUES
(1,999999999999999999999999999999999999999);
-- The same valid value through LOAD DATA fails.
LOAD DATA INLINE FORMAT='csv',
DATA='2,999999999999999999999999999999999999999\n'
INTO TABLE d256 FIELDS TERMINATED BY ',';
SELECT * FROM d256 ORDER BY id;
-- Scaled and wider Decimal256 targets fail through the same path.
CREATE TABLE wide(
id INT PRIMARY KEY,
d DECIMAL(40,0),
s DECIMAL(50,10)
);
LOAD DATA INLINE FORMAT='csv',
DATA='1,9999999999999999999999999999999999999999,1234567890123456789012345678901234567890.1234567890\n'
INTO TABLE wide FIELDS TERMINATED BY ',';Additional information
The CSV conversion switch in pkg/sql/colexec/external/external.go has explicit parsing and append cases for types.T_decimal64 and types.T_decimal128, but no types.T_decimal256 case. Decimal256 therefore reaches the default branch that emits the internal "not support now" error. The Parquet external path already has dedicated Decimal256 conversion support, which further isolates the missing implementation to CSV field conversion.
The Decimal64, Decimal128, Decimal256 boundary, normal-INSERT control, wider precision, and scaled Decimal256 cases were reproduced three times on the same latest-main build. Existing decimal LOAD DATA issues concern different Parquet conversion and precision-validation paths; no open or closed issue covering CSV Decimal256 loading was found.
Activity
[-][Bug]: CSV LOAD DATA cannot write DECIMAL256 columns[/-][+][Bug]: CSV external paths cannot read or load DECIMAL256 columns[/+]Ariznawlll commentedon Sep 10, 2026
继续沿同一 CSV external 算子验证后,影响范围不只
LOAD DATA:只读 external table 也无法解析 Decimal256,因而SELECT和INSERT ... SELECT都返回同一个内部错误。两条执行路径均返回:
使用独立、合法的 Decimal128 CSV 文件和
DECIMAL(38,0)/DECIMAL(38,10)外表时,连续三次扫描均精确返回,INSERT ... SELECT也保持原值。因此问题范围是 CSV external field conversion 缺少 Decimal256,而不是LOAD DATA语句层或输入文件访问问题。Ariznawlll commentedon Sep 10, 2026
格式对照进一步限定了问题边界:Parquet external 路径已实现 Decimal256。
使用 Arrow
decimal256(50,10)文件,包含 40 位整数部分、负值和 NULL,执行:外表扫描和 Parquet
LOAD DATA连续三次均精确返回:因此不应把问题归为 Decimal256 在 external 算子中的统一不支持;缺口具体位于 CSV field conversion switch。Parquet 已有专门的 Decimal256 parse/decode 分支。
[-][Bug]: CSV external paths cannot read or load DECIMAL256 columns[/-][+][Bug]: CSV and JSONLINE external paths cannot read or load DECIMAL256 columns[/+]Ariznawlll commentedon Sep 10, 2026
JSONLINE 也经过同一缺失的 Decimal256 field conversion 分支,因此影响范围需要从 CSV 扩展为 CSV + JSONLINE。
后两条连续三轮均返回:
Decimal128 对照中的 JSON number 和 JSON string 均保留 10 位 scale 的精确值;Decimal256 两种输入在写入前被拒绝,没有观察到先转浮点导致的另一类精度损失。代码层
CsvReader共享 CSV/JSONLINE 行读取,再进入external.go的类型转换 switch,因此与原报告是同一个缺口。iamlinjunhong commentedon Sep 10, 2026
@VioletQwQ-0 已经在修了
fix(external): support Decimal256 CSV and JSONLINE loads (#28612)
VioletQwQ-0 commentedon Sep 16, 2026
@Ariznawlll 请验收本 issue,现正式转测,保持 OPEN 等待 QA 结论。
修复 PR:#28612
PR head:
0d316a114d87de3108151ea5a04988dd0b075362main 合入 commit:
60248a08953f7d55b80c4980284c3fd89cfd9aef开发验证:该 head 的 CI Required、Compose/Proxy BVT 均成功,合入后的 TKE BVT 成功。CI:https://github.com/matrixorigin/matrixone/actions/runs/34833344163 。最终 review 记录
decimal256_external_load.sql25/25 通过。PR 正文中的旧 head/pending 快照不代表上述最新结果;这些自动化结果不等于正式 QA PASS。请在包含上述合入 commit 的版本验证 CSV、JSONLINE object/array 的 external SELECT、INSERT SELECT、LOAD DATA;覆盖精度 38/39 边界、40/50/76、正负数、scale/舍入、NULL/空值、JSON number/string 精度保持,以及非法输入/溢出后的无部分写入和后续有效执行。以 Parquet/普通 INSERT 为对照,保留精确数值断言。
请记录实际测试 build/commit、环境拓扑与输入方式、各场景结果,并明确回复 PASS/FAIL;如失败附最小 SQL 和实际/期望结果。当前 QA 环境与部署版本待测试人记录,本次交接不声明部署验收完成。
Ariznawlll commentedon Sep 16, 2026
测试版本
main9572bd3311abb16d1df939956408a727bcf83eba原问题验证
以 39 位整数写入
DECIMAL(39,0):CSVLOAD DATA INLINE与 JSONLINELOAD DATA INLINE ... jsontype='object'各执行 3 次,均写入 1 行;查询结果与输入逐位一致,字符长度均为 39。DECIMAL(40,0)与DECIMAL(50,10)的 CSV 宽精度/带 scale 控制也成功。Happy Path 覆盖
DECIMAL(38,0)CSV 边界控制成功。DECIMAL(39,0)CSV、JSONLINE 及宽精度 CSV 路径均返回精确值。Unhappy Path 覆盖
DECIMAL256的解析和写入保真,已验证无截断、无漏写。白盒验证
不适用。本次为部署后的 MySQL 协议黑盒 SQL 验收;未以 UT 替代功能验证。
回归测试
已加入 motr PR #181:
suites/14_issue_regression/t/issue_28590_decimal256_load.test,覆盖 CSV、JSONLINE、Decimal128 边界和 Decimal256 宽精度结果。测试证据
motr PR #181 中的 SQL/result 为已执行输入与结果断言;环境实测三轮均返回
1 / 精确值 / 39。测试结论
测试通过。
fix(external): support Decimal256 CSV and JSONLINE loads (matrixorigi…
fix(external): support Decimal256 CSV and JSONLINE loads (matrixorigi…
fix(external): support Decimal256 CSV and JSONLINE loads (matrixorigi…