Skip to content

[Bug]: LOAD DATA INLINE silently ignores supported SET NULLIF and persists wrong values #31232

Done

Description

@Ariznawlll

问题

LOAD DATA INLINE ... SET flag=NULLIF(flag,0) 返回成功,但 SET 未生效,原始 0 被写入目标表。完全相同的数据通过文件型 LOAD DATA INFILE 执行同一 SET 后正确写入 NULL。这会造成静默数据错误;不是 Python SDK 特有问题。

环境

  • 官方 main 源码:5fe08a3307e246e1ab9951ab690b50557af0f509;隔离单节点 MatrixOne,VERSION() = 8.0.30-MatrixOne-v1.3.0。
  • 2026-10-26;三轮分别使用全新 INLINE、文件型和不带 SET 的正常对照表,3/3 一致。

最小复现

CREATE TABLE inline_dst(id INT PRIMARY KEY,s VARCHAR(20),flag INT);
LOAD DATA INLINE FORMAT='csv', DATA='1,alpha,0\n2,beta,7\n'
INTO TABLE inline_dst FIELDS TERMINATED BY ',' SET flag=NULLIF(flag,0);
SELECT * FROM inline_dst ORDER BY id;
-- 实际:(1,'alpha',0),(2,'beta',7)
-- 预期:(1,'alpha',NULL),(2,'beta',7)

将字节相同的 1,alpha,0\n2,beta,7\n 写入 /tmp/input.csv,文件型直接对照:

CREATE TABLE file_dst LIKE inline_dst;
LOAD DATA INFILE '/tmp/input.csv' INTO TABLE file_dst
FIELDS TERMINATED BY ',' SET flag=NULLIF(flag,0);
SELECT * FROM file_dst ORDER BY id;
-- (1,'alpha',NULL),(2,'beta',7)

另在不带 SET 的正常 INLINE 对照表上得到 (1,'alpha',0),(2,'beta',7)。这与错误路径完全相同,说明 INLINE 的 SET 被静默忽略;三轮执行语句都返回成功,连接后续 SELECT 1 正常。NULLIF(column,literal) 是当前服务端 LOAD SET 明确支持的形式;其它任意表达式返回 20105,不涉及这里。

同根 JSONLINE 扩展

把输入改为 {"id":1,"flag":0}\n{"id":2,"flag":7}\n 并使用

LOAD DATA INLINE FORMAT='jsonline', DATA='{"id":1,"flag":0}\n{"id":2,"flag":7}\n',
JSONTYPE='object' INTO TABLE inline_json SET flag=NULLIF(flag,0);

三轮均成功但读回 (1,0),(2,7);同样字节文件通过 LOAD DATA INFILE {'filepath'='...','format'='jsonline','jsondata'='object'} INTO TABLE file_json SET flag=NULLIF(flag,0) 三轮均得 (1,NULL),(2,7)。这说明问题在 INLINE 重建选项,不限定 CSV 解析器。

同根边界:LINES STARTING BY 也在 INLINE 路径丢失

相同字节输入 DATA:1,alpha\nDATA:2,beta\n,执行

LOAD DATA INLINE FORMAT='csv', DATA='DATA:1,alpha\nDATA:2,beta\n'
INTO TABLE inline_prefix FIELDS TERMINATED BY ',' LINES STARTING BY 'DATA:';

3/3 报 20101 the input value 'DATA:1' is not int32 type for column 0,目标表为空,说明行前缀没有被剥离。文件型 LOAD DATA INFILE ... FIELDS TERMINATED BY ',' LINES STARTING BY 'DATA:' 使用同字节文件 3/3 精确导入 (1,'alpha'),(2,'beta');连接后续仍可用。白盒同一 getExternParam INLINE 重建未复制 Tail.Lines.StartingBy,因此属于同一“INLINE 编译参数丢失”根因,不需另开 issue。

白盒线索

pkg/sql/plan/bind_load.go:109 与 pkg/sql/plan/build_load.go:645 会把 SET ... NULLIF 解析进 ExternParam.NullMap。但 pkg/sql/compile/compile.go:getExternParam 在 LoadType == INLINE 时仅从 ExternScan 重建 Data、Format、IgnoredLines、Fields、JsonType,未传递 NullMap,也未传递 Tail.Lines.StartingBy;文件型路径则从 TableDef.Createsql 的 JSON 反序列化完整 ExternParam。最终 pkg/sql/colexec/external/external.go:getColData 依赖 param.Extern.NullMap 判断是否写 NULL。因此 INLINE 路径丢失转换映射,与黑盒结果吻合。

去重与证据

已查 matrixorigin/matrixone open/closed issue 中 LOAD DATA INLINE SET NULLIF、INLINE SET LOAD DATA、inline nullif,及 mo-test-reports/mysql-compatibility-contract/README.md;未发现同一缺陷或正式限制。#31229 是 Python SDK 内联 CSV 参数传递错误,本问题即使用直接 SQL 也会复现,根因不同。

完整隔离 3/3 脚本:/private/tmp/mo-sdk-io-20261026/inline_set_server_probe.py、inline_json_set_probe.py、inline_lines_start_probe.py;CSV 与 JSONLINE 均是 INLINE + SET [0,7]、文件型 + SET [NULL,7],行前缀边界是 INLINE 错误/空表、文件型两行准确,连接可用。

合并跟踪:LOAD入口参数完整性与字节保真

本项统一跟踪 #31725、#31645、#31232,唯一负责人:@iamlinjunhong。这是问题整理,不代表修复完成或验收通过;各来源的独立复现与验收仍须分别完成。以下证据为原报告/评论的记录,不是本轮重新实测。

独立验收与边界

范围边界:不吞大文件吞吐、分布式执行、任意SET表达式新增能力或完整类型转换重构。

来源 #31725:原始报告完整保留

来源:https://github.com/matrixorigin/matrixone/issues/31725,作者:iamlinjunhong,创建时间:2026-10-29T07:47:18Z。

#31725 完整复现、版本、证据和预期

Description

MatrixOne LOAD DATA uses a comma as the default field separator, while MySQL 8.0 uses a tab (\t). For a migration from MySQL this breaks the most common form of the statement — LOAD DATA ... INTO TABLE t with no FIELDS clause — in both directions:

  • A tab-separated data file (the format MySQL's default semantics expect) cannot be loaded by MatrixOne.
  • A comma-separated data file (which MySQL's default treats as one field per row) is silently split into several columns by MatrixOne.

The same mismatch silently replaces an explicit FIELDS TERMINATED BY '' (MySQL: fixed-row, non-delimited format) with the comma default, because the option is only honored when non-empty.

Environment

  • Commit ID: 95341b4
  • Branch Name: main (detached HEAD)
  • Other Environment Information:
    • Hardware: Apple Silicon (darwin/arm64), 10 cores, macOS
    • Server: standalone mo-service -launch built with make build, launch configs copied from etc/launch into .loom-test/launch20200/ with all ports offset by 20200 (frontend 26201), data dir .loom-test/mo-data20200
    • Client: Homebrew [email protected] CLI (8.0.x): mysql -h 127.0.0.1 -P 26201 -udump -p111 --local-infile=1 -f -N
    • Comparison server: Homebrew [email protected] (mysqld 8.0.46) started in the workspace via --initialize-insecure on port 23506 with local_infile=ON; same client.

Steps to Reproduce

  1. Create a tab-separated file (tabs between x, y, z):
printf 'x\ty\tz\np\tq\tr\n' > /tmp/tab3.csv
printf 'x,y,z\np,q,r\n' > /tmp/comma3.csv
od -c /tmp/tab3.csv
# 0000000    x  \t   y  \t   z  \n   p  \t   q  \t   r  \n
  1. On MatrixOne (fresh standalone instance, make build):
create database fr4; use fr4;
set sql_mode='STRICT_TRANS_TABLES';
create table t3(a char(5), b char(5), c char(5));

-- (a) Server-side INFILE, no FIELDS clause
load data infile '/tmp/tab3.csv' into table t3;

-- (b) LOCAL INFILE, no FIELDS clause
truncate table t3;
load data local infile '/tmp/tab3.csv' into table t3;
select concat('[',coalesce(a,'N'),']','[',coalesce(b,'N'),']','[',coalesce(c,'N'),']') from t3;

-- (c) LOCAL INFILE, explicit empty terminator
truncate table t3;
load data local infile '/tmp/tab3.csv' into table t3 fields terminated by '';
select concat('[',coalesce(a,'N'),']','[',coalesce(b,'N'),']','[',coalesce(c,'N'),']') from t3;

-- (d) comma-separated file, no FIELDS clause
truncate table t3;
load data local infile '/tmp/comma3.csv' into table t3;
select concat('[',coalesce(a,'N'),']','[',coalesce(b,'N'),']','[',coalesce(c,'N'),']') from t3;
  1. Run steps (a)–(d) identically on MySQL 8.0.46 to compare.

Actual Behavior (MatrixOne)

  • (a) load data infile '/tmp/tab3.csv' into table t3; fails the whole import:
ERROR 20301 (HY000): invalid input: the data of row 1 contained is not equal to input columns

The row is parsed as a single field, so 1 field vs 3 columns is rejected; no rows are loaded.

  • (b) load data local infile (same clause) silently loads each whole line into column a and leaves b, c NULL — no error, no warning:
===MO_tabfile_LOCAL_default
[x\ty\tz][N][N]
[p\tq\tr][N][N]
  • (c) fields terminated by '' behaves exactly like the default (silent fallback to ,) — same [x\ty\tz][N][N] result locally, same ERROR 20301 for server-side INFILE.
  • (d) The comma file loads as 3 fields per row: [x][y][z], [p][q][r].

Expected Behavior (MySQL 8.0.46 reference, actually run)

  • (a)+(b) The same tab file with no FIELDS clause loads 3 fields per row in both strict and default mode:
MY_tabfile_default	[x][y][z]
MY_tabfile_default	[p][q][r]
  • (c) fields terminated by '' is accepted (fixed-row format, not an error), loading a from the leading bytes per the fixed-row rules.
  • (d) The comma file is NOT split: each line is one field, a='x,y,z' (truncated per mode), b/c left NULL with Warning 1261 Row 1 doesn't contain data for all columns:
MY_commafile_default	[x,y,z][N][N]
MY_commafile_default	[p,q,r][N][N]
Warning	1261	Row 1 doesn't contain data for all columns

MySQL 8.0 docs (https://dev.mysql.com/doc/refman/8.0/en/load-data.html) define the default as FIELDS TERMINATED BY '\t'. MatrixOne's default of , therefore diverges from the reference engine on the default clause in both directions, and additionally hides the explicit empty terminator.

Root cause / code locations

  • pkg/sql/parsers/tree/update.go:538 — DefaultFieldsTerminated = "," is the constant used whenever no FIELDS TERMINATED BY is given. MySQL's default is a tab.
  • pkg/sql/colexec/external/types.go:492 — CSVConfigForLoad seeds the reader config from this constant; it is the authoritative LOAD-clause mapping for both server INFILE and LOCAL INFILE.
  • pkg/sql/colexec/external/types.go:500 — if terminated != nil && terminated.Value != "" silently drops an explicit FIELDS TERMINATED BY '' instead of honoring it (MySQL fixes the field/row layout to non-delimited reading for ''). The same non-empty-only guard exists in the parallel-reader configuration in pkg/sql/plan/build_load.go (newReaderWithParam, ~L134–190).

Additional information

  • Two independent manifestations, one root cause: server-side INFILE aborts the import with ERROR 20301 (loud), LOCAL INFILE inserts whole lines into the first column with NULL-padded trailing columns and no signal at all (silent data misplacement — the dangerous one, because the load "succeeds").
  • A workaround exists (FIELDS TERMINATED BY '\t' explicitly, which loads correctly in MatrixOne — verified [x][y][z] / [p][q][r]), hence severity s1 rather than s0.
  • Recommended fix: change tree.DefaultFieldsTerminated to "\t" to match MySQL, and treat an explicit FIELDS TERMINATED BY '' as the fixed-row configuration instead of silently falling back to the default. Changing the default separator alters the interpretation of previously-loaded comma files, so a compatibility/announcement note is advised; however matching the documented reference-engine default is the correct long-term behavior, and existing scripts that rely on comma can be made explicit with FIELDS TERMINATED BY ',' which already works.
  • The LOCAL-vs-server inconsistency (one errors, the other silently misplaces data for the identical file and clause) suggests the two ingestion paths differ in column-count validation; that inconsistency is itself worth normalizing, but the separator default remains the single root cause addressed here.
  • Related but distinct existing issues cover blank-line skipping and ENCLOSED BY ''/line-terminator semantics on CSV readers ([Bug]: CSV readers lose records or ignore enclosure and line-terminator semantics #30329); none of them covers the field-separator default, and I found no issue or PR mentioning the comma-vs-tab default mismatch.
Full reproduction, exactly as Loom ran it
# 1. data files (run in any scratch dir; use an absolute path in the SQL below)
printf 'x\ty\tz\np\tq\tr\n' > /tmp/tab3.csv
printf 'x,y,z\np,q,r\n' > /tmp/comma3.csv

# 2. MatrixOne standalone (built with `make build`, launch configs from etc/launch with port offset 20200, frontend on 26201):
mysql -h 127.0.0.1 -P 26201 -udump -p111 --local-infile=1 -f -N <<'SQL'
drop database if exists fr4; create database fr4; use fr4;
set sql_mode='STRICT_TRANS_TABLES';
create table t3(a char(5), b char(5), c char(5));

load data infile '/tmp/tab3.csv' into table t3;
-- expect: ERROR 20301 (HY000): invalid input: the data of row 1 contained is not equal to input columns

truncate t3;
load data local infile '/tmp/tab3.csv' into table t3;
select concat('[',coalesce(a,'N'),']','[',coalesce(b,'N'),']','[',coalesce(c,'N'),']') from t3;
-- expect (actual MO): [x\ty\tz][N][N] / [p\tq\tr][N][N]   (MySQL 8.0: [x][y][z] / [p][q][r])

truncate t3;
load data local infile '/tmp/tab3.csv' into table t3 fields terminated by '';
select concat('[',coalesce(a,'N'),']','[',coalesce(b,'N'),']','[',coalesce(c,'N'),']') from t3;
-- expect (actual MO): identical comma-default fallback: [x\ty\tz][N][N] / [p\tq\tr][N][N]

truncate t3;
load data local infile '/tmp/comma3.csv' into table t3;
select concat('[',coalesce(a,'N'),']','[',coalesce(b,'N'),']','[',coalesce(c,'N'),']') from t3;
-- expect (actual MO, 3 fields split): [x][y][z] / [p][q][r]  (MySQL 8.0: one field + Warning 1261)
SQL

# 3. MySQL 8.0.46 reference (Homebrew [email protected], --initialize-insecure, local_infile=ON):
mysql -h 127.0.0.1 -P 23506 -uroot --local-infile=1 -N <<'SQL'
drop database if exists fr; create database fr; use fr;
create table t3(a char(5), b char(5), c char(5));
load data local infile '/tmp/tab3.csv' into table t3;
select 'MY_tabfile_default', concat('[',coalesce(a,'N'),']','[',coalesce(b,'N'),']','[',coalesce(c,'N'),']') from t3;
-- expect: [x][y][z] / [p][q][r]  (3 fields, tab default)
set sql_mode='';
truncate t3;
load data local infile '/tmp/comma3.csv' into table t3;
show warnings;
select 'MY_commafile_default', concat('[',coalesce(a,'N'),']','[',coalesce(b,'N'),']','[',coalesce(c,'N'),']') from t3;
-- expect: [x,y,z][N][N] / [p,q,r][N][N] + Warning 1261 Row 1 doesn't contain data for all columns
SQL

Found by Loom bug hunt (module: custom-de41a00730; tests: unit, white-box, end-to-end, concurrency; severity: S1)

来源 #31645:原始报告完整保留

来源:https://github.com/matrixorigin/matrixone/issues/31645,作者:iamlinjunhong,创建时间:2026-10-29T03:08:29Z。

#31645 完整复现、版本、证据和预期

Is there an existing issue for the same bug?

I checked existing issues and open PRs. See Additional information for the related issues reviewed.

Branch Name

main snapshot (Loom-managed detached HEAD)

Commit ID

95341b4

Other Environment Information

  • Hardware parameters: Apple M4, arm64; Go 1.27.1.
  • OS type: macOS 15.5, Darwin 24.5.0.
  • Others: locally built single-process standalone mo-service (one CN, one TN, one LogService), DISK-V2 local/shared storage. No production modifications. GitHub main SHA was verified equal to this workspace SHA at the start of testing.

Actual Behavior

For the same 18-byte UTF-8 CSV, serial LOAD inserts HEX values 626262 and EFBBBF616161, while PARALLEL 'true' inserts 616161 and 626262. U+FEFF is a data character after the ignored header, not the file's BOM. LOAD succeeds and changes the value silently. This reproduces three times even though the small file is below parallel admission and ultimately uses one reader.

The same root cause also affects a genuine non-strict byte-range split. A 268435463-byte fixture produced [0,134217732,134217732,-1] with max_dop=2. Serial and MySQL both returned count=4097, SUM(LENGTH(s))=4100, SUM(LENGTH(pad))=268423169; parallel returned the same row count and pad sum but SUM(LENGTH(s))=4097 on two runs.

Expected Behavior

Both parallel and serial LOAD must insert exactly the two byte strings EFBBBF616161 and 626262 after ignoring the header, as MySQL 8.0.46 does for the same file and clauses (without MatrixOne's PARALLEL/STRICT extensions).

Steps to Reproduce

The scripts below connect to the test-owned service on TCP 26201 (set MO_PORT to another existing standalone service's MySQL port if necessary). The test uses root/111. No LOAD-specific CN configuration was changed.

Exact local service setup: copy etc/launch to .loom-test/launch; replace every ./mo-data path in the copied TOML files with an absolute workspace-owned .loom-test//mo-data path, and make launch.toml reference the absolute copied CN/TN/LOG configs. Set cn.port-base=38200, tn.port-base=39200, observability.status-port=27201 in all three configs. Add [cn.frontend] port=26201, portOfRpcServerInComputationEngine=40200, unix-socket="/.loom-test/mo.sock" to cn.toml. Add [hakeeper-client] service-addresses=["127.0.0.1:52201"] to each service config. Add [logservice] logservice-address="127.0.0.1:52201", raft-address="127.0.0.1:52200", gossip-address="127.0.0.1:52202", gossip-seed-addresses=["127.0.0.1:52202"] to log.toml. Run make build, then /mo-service -launch /.loom-test/launch/launch.toml -debug-http 127.0.0.1:26260 from the repository root. Wait for SQL readiness and ISCP-Task Start in its log before running the reproduction. These port changes isolate the test and are not prerequisites for the defect.

Requires Python 3 and PyMySQL. Run from the repository root:

python3 - <<'PY'
from pathlib import Path
import os,pymysql
root=Path.cwd();path=root/'.loom-test/2011f56fec05f104073456c682a473ba/bom-repro.csv'
path.parent.mkdir(exist_ok=True);path.write_bytes(b'header\n\xef\xbb\xbfaaa\nbbb\n')
for name,port,password in [('MatrixOne',int(os.getenv('MO_PORT','26201')),'111'),('MySQL 8.0',int(os.getenv('MYSQL_PORT','23506')),'')]:
 c=pymysql.connect(host='127.0.0.1',port=port,user='root',password=password,autocommit=True,charset='utf8mb4')
 try:
  with c.cursor() as q:
   q.execute('create database if not exists loom_bom_repro');q.execute('use loom_bom_repro');q.execute('drop table if exists dst');q.execute('create table dst(s varchar(32))')
   q.execute('select version()');print(name,'version',q.fetchone(),flush=True)
   for run in range(3):
    for mode in (['false','true'] if name=='MatrixOne' else ['mysql']):
     q.execute('truncate table dst')
     sql="load data infile '"+str(path)+"' into table dst fields terminated by ',' lines terminated by '\\n' ignore 1 lines"
     if name=='MatrixOne':sql+=" parallel '"+mode+"' strict 'false'"
     q.execute(sql);q.execute('select hex(s) from dst order by hex(s)')
     print(name,'run',run+1,'parallel',mode,q.fetchall(),flush=True)
   q.execute('drop database loom_bom_repro')
 finally:c.close()
PY

The MySQL comparison uses a temporary mysqld 8.0.46 on TCP 23506, initialized with --initialize-insecure; its [mysqld] config sets basedir=/opt/homebrew/opt/[email protected], datadir=/.loom-test//mysql-data, port=23506, bind-address=127.0.0.1, mysqlx=0, local-infile=1 and secure-file-priv=/.loom-test/2011f56fec05f104073456c682a473ba. The reproduction writes its file under that allowed directory. Root has an empty password. Set MYSQL_PORT when comparing against a different MySQL 8.0 instance.

Additional information

Root cause: buildLoad pre-scans IGNORE records when parallel was requested, sets FileStartOff to the header end and zeroes Tail.IgnoredLines before size-based parallel admission. CsvReader then opens a new CSVParser at this nonzero file position. CSVParser.readBlock sees parser.pos==0 and calls bom.Clean without knowing the absolute file offset; it treats data bytes EF BB BF as a new file header. Non-strict shard restarts use the same parser construction and have the same behavior.

Compatibility evidence: the reproduction below runs the same source file and standard LOAD clauses against real MySQL 8.0.46, which preserves EFBBBF616161 on all three runs. MO's serial control also preserves it. The value starts on physical line two, so this is not a disagreement about how to interpret an actual file-leading BOM.

Related issues read: #30050 is a schema-inference/file-relations design task; #31445 concerns quote-state resynchronization, while this reproduction contains no quoted or multiline fields. Neither covers this root cause. Searches for CSV BOM / BOM and open PRs found no repair. Workaround: PARALLEL 'false'. Recommended repair: preserve absolute-offset/header state across reader restarts, rather than removing U+FEFF characters from existing data.

Found by Loom bug hunt (module: custom-82082add71; tests: white-box, black-box, end-to-end, concurrency; severity: S1)

Activity

  1. added this to the MO-202610 milestone on Oct 26, 2026
  2. added
    kind/bug
    on Oct 26, 2026
  3. added theissue type on Oct 26, 2026
  4. added
    severity/s0
    ai-easy
    and removed on Oct 26, 2026
  5. gouhongshen commented on Nov 4, 2026

    @gouhongshen
    Contributor

    PR #32198 is trying to fix this issue.

  6. gouhongshen commented on Nov 5, 2026

    @gouhongshen
    Contributor

    PR #32198 has merged and is awaiting manual validation. The issue remains open.

  7. XuPeng-SH commented on Nov 5, 2026

    @XuPeng-SH
    Contributor

    合并后范围核对:#32198 已交付 INLINE 选项修复,合并总项仍保留研发

    PR #32198 已于 2026-11-05 08:09:03 UTC 合入 main,合并 SHA 为 1d51125661c60ff5216c1216a897a3d312875336,最终 head 为 95202c765ba561f4c44ed625197fdf56fe972c34。该修复覆盖 INLINE CSV/JSONLINE 的 SET NULLIF 与 LINES STARTING BY 传递、PREPARE 重规划及外部表参数序列化。最终 head 的 CI run 41983392627 成功,包含 CI Required、Ubuntu UT、覆盖率及 PROXY/PESSIMISTIC BVT。作者还报告了相关包与定向 SQL 验证;以上是远端 CI 和作者证据,本轮未运行本地测试,也不代表 QA 验收通过。

    当前正文仍明确合并跟踪 #31725、#31645,不能仅按已恢复的窄标题判断完成:

    • 分隔符范围尚未交付:上述 main 的 pkg/sql/parsers/tree/update.go 仍将默认分隔符设为逗号,pkg/sql/plan/csv_config.go 仍仅在非空时应用显式 terminator,未实现正文要求的默认 tab 与显式空值区分。
    • PARALLEL/IGNORE LINES 后的 U+FEFF 字节保真范围也未由本 PR 修复:预扫描设置 FileStartOff、偏移 reader 新建 parser、parser 在局部 pos==0 调用 bom.Clean 的链路仍在。这里是当前源码范围核对,不冒称本轮重新复现了运行时失败。

    因此保留 @iamlinjunhong 继续处理合并总项,不执行整项 QA 改派。原因是正文已有的独立开发范围仍未完成,而不是未运行测试。INLINE 已交付部分可单独验证;总项仍需分别完成分隔符及 U+FEFF 边界,不能用另一来源通过替代。#31725/#31645 的去重关闭不等于修复完成。

  8. Ariznawlll commented on Nov 29, 2026

    @Ariznawlll
    CollaboratorAuthor

    结论

    测试不通过。#32198 已交付的 INLINE 参数传递修复在本轮通过,但本 Issue 正文合并跟踪的默认分隔符及 U+FEFF 字节保真两项仍可稳定复现。因此不能仅按标题中的 INLINE 问题关闭整个 Issue;保持开放,本轮不改派。

    关键证据

    版本与环境

    1. 已通过:INLINE CSV / JSONLINE 的 NULLIF 与行前缀

    CSV 原始输入为 1,alpha,0\n2,beta,7\n,执行 SET flag=NULLIF(flag,0)。三轮均得到:

    (1, 'alpha', NULL)
    (2, 'beta', 7)
    

    JSONLINE 输入为 {"id":1,"flag":0}\n{"id":2,"flag":7}\n,同样执行 SET flag=NULLIF(flag,0),三轮均得到 (1,NULL),(2,7)。

    行前缀输入为 DATA:1,alpha\nDATA:2,beta\n,INLINE CSV 使用 LINES STARTING BY 'DATA:',三轮均精确得到 (1,'alpha'),(2,'beta')。

    2. 未通过:省略 FIELDS 时,合法 tab 文件仍被拒绝

    生成文件的精确字节:

    Path('/test-owned/input.tsv').write_bytes(b'1\talpha\n2\tbeta\n')

    在新表执行:

    CREATE TABLE tab_dst(id INT,s VARCHAR(20));
    LOAD DATA INFILE '/test-owned/input.tsv' INTO TABLE tab_dst;
    SELECT * FROM tab_dst ORDER BY id;

    MO 三轮实际输出一致:

    ERROR 20301: invalid input: the data of row 1 contained is not equal to input columns
    导入后目标行集:空
    同连接 SELECT 42:42
    

    同一文件在 MySQL 8.0.45 使用标准 LOAD DATA LOCAL INFILE ... INTO TABLE tab_dst,三轮均准确得到 (1,'alpha'),(2,'beta')。MO 使用本地服务端文件入口,MySQL 使用 LOCAL 传输相同原始字节;两边均未指定 FIELDS 分隔符。预期默认 tab,不能将逗号默认当作兼容结果。

    3. 未通过:PARALLEL/IGNORE LINES 把数据 U+FEFF 当作文件 BOM 删除

    精确 18 字节文件:

    Path('/test-owned/bom.csv').write_bytes(b'header\n\xef\xbb\xbfaaa\nbbb\n')

    执行以下两种模式,各自使用新表:

    CREATE TABLE bom_dst(s VARCHAR(32));
    LOAD DATA INFILE '/test-owned/bom.csv' INTO TABLE bom_dst
    FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' IGNORE 1 LINES
    PARALLEL 'true' STRICT 'false';
    SELECT HEX(s) FROM bom_dst ORDER BY HEX(s);
    模式 三轮实际 HEX 行集 结果
    MO PARALLEL 'false' 626262, EFBBBF616161 保留原始字节
    MO PARALLEL 'true' 616161, 626262 U+FEFF 丢失,3/3
    MySQL 8.0.45 标准 LOAD,忽略同一行头 626262, EFBBBF616161 保留原始字节

    U+FEFF 位于被忽略表头后的第二物理行,是数据字符,不是文件起始 BOM。并行开关路径返回成功但改写了数据;同连接后续 SELECT 42 正常。这是实际字节差异,不能由行数一致或语句成功判定通过。

    待解决点

    • 默认分隔符问题及 PARALLEL true 下 U+FEFF 丢失仍需修复;本轮只确认上述具体失败,不推断所有 LOAD 入口均相同。
    • 本轮没有复验显式空 separator、原始 268435463 字节真实分片场景、完整外部表/重规划组合。小文件的失败已足以阻止整项关闭,大文件覆盖仍待补齐。
    • 没有往 MatrixOne 主库提测试 PR,也没有把已知失败的实际输出写成通过基线。

    最终结论:测试不通过。INLINE CSV/JSONLINE NULLIF 和 LINES STARTING BY 子项三轮通过;未通过项:默认 tab 导入仍报 20301,PARALLEL/IGNORE LINES 仍删除数据 U+FEFF,两项各稳定复现 3/3。保持开放,不改派;显式空分隔符与大文件真实分片仍未验收。

  9. Ariznawlll commented on Nov 30, 2026

    @Ariznawlll
    CollaboratorAuthor

    原 INLINE 场景验收通过;两个独立 LOAD 边界已拆分

    两个已确认但机制不同的边界分别独立跟踪:

    1. 省略 FIELDS 时默认 TAB 文件仍被拒绝:[Bug]: LOAD DATA without FIELDS rejects tab-separated input instead of defaulting to TAB #33508 [Bug]: LOAD DATA without FIELDS rejects tab-separated input instead of defaulting to TAB #33508
    2. PARALLEL + IGNORE LINES 后首行 U+FEFF 被剥离:[Bug]: Parallel LOAD DATA strips U+FEFF from the first data row after IGNORE LINES #33509 [Bug]: Parallel LOAD DATA strips U+FEFF from the first data row after IGNORE LINES #33509

    两项均未写成 PASS golden,也不由本次 INLINE 结果推断已修复。因此关闭本 Issue 的原 INLINE 参数传递范围;#33508、#33509 继续保持 OPEN。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-easykind/bugseverity/s0

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions