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]: JSONLINE OUTFILE silently drops a column when SELECT aliases are duplicated #30703
SELECT ... INTO OUTFILE ... FORMAT 'jsonline' 遇到两个相同的列别名时返回成功,但生成的每行 JSON 只保留后一列,前一列的值被静默丢弃。普通 SELECT 与 CSV 导出都保留两列;唯一别名的 JSONLINE 导出也正常。
环境
MatrixOne main commit 3a1e42b4308bd0098e055ddb9360a07f85201d9c,隔离本地单 TN、双 CN;2026-10-21。
最小复现
CREATETABLEt(id INTPRIMARY KEY, a INT, b INT);
INSERT INTO t VALUES (1,11,22),(2,33,44);
SELECT a AS x,b AS x FROM t ORDER BY id;
-- 两行分别是 (11,22)、(33,44)SELECT a AS x,b AS x FROM t ORDER BY id
INTO OUTFILE '/tmp/duplicate.jsonl' FORMAT 'jsonline';
-- 返回成功,文件却只有:-- {"x":22}-- {"x":44}
对照:SELECT a AS x,b AS y ... FORMAT 'jsonline' 导出 {"x":11,"y":22}、{"x":33,"y":44};相同重复别名导出 CSV 仍保留 11,22 和 33,44。基表本身始终是 2 行,SUM(a)=44, SUM(b)=66。
QA follow-up for PR #30807 at head dca0d807b3a3f382aaa8635716bc23216de18046:
The duplicate-name guard still has a silent-data-loss edge for an empty result column name. duplicatedJSONLineColumn returns "" both when no duplicate exists and when the duplicate name itself is empty, while constructJSONLine only rejects dup != "". Thus duplicate empty headings (reachable with NAME_CONST('', ...)) pass the guard and the per-row map overwrites one value. The current unit tests cover repeated "x" but not repeated empty names.
Please return an explicit found flag/error (or otherwise distinguish absence from an empty name) and add regression coverage for ["", ""] and an empty duplicate alongside another name, including the export error/no-bytes behavior. This is a static source review; I did not run the frontend or SQL repro locally. The submitted PR review also records an isolated helper probe for this boundary.
QA follow-up for PR #30807, current head 3c384538553c24f63b525dd6fff7db4e6b3eee7b:
The previously reported empty-name sentinel bug is addressed in the current source: duplicatedJSONLineColumn now returns (name, found), and the writer rejects repeated empty names before serializing rows. Regression cases cover repeated empty names, an empty duplicate followed by another duplicate, a single empty name, no output on rejection, and memory-pool balance. I reviewed the current commit diff and it contains this fix.
Validation caveat: the PR author reports the frontend tests and live SQL/export cases passing on the branch. I did not execute those tests. The local checkout is on main at 460b96365a381e74916b044a99fc9423c33ad3fd, not the PR head, and Go is unavailable in this workspace. Commit status has no checks; the two PR-triggered E2E runs currently listed are Iceberg Connector and Connector/J pool-reset, both in progress and not targeted coverage. Existing issue assignee is already Ariznawlll; no assignment change needed. Next verification: obtain exact-head frontend package/required checks and run the regression plus live JSONLINE/CSV controls.
Regression and extended verification for #30703 (2026-10-23)
Verification Environment
MatrixOne origin/main: bc84bd142600b745503e225cb89cb1526df8d35e — fix(plan): eliminate unobserved sorts below scalar COUNT (#30828). I fetched origin/main; the running mo-service reports this exact VCS revision, and both CN process binaries match the freshly built binary hash.
Topology: 2 CN / 1 TN / 1 Log service / 1 Proxy. Proxy 6001, CN1 16001, and CN2 16002 were reachable. The SQL below was executed through the real MySQL text protocol, not just connectivity-checked.
OK — The original 2-row SELECT a AS x,b AS x ... INTO OUTFILE ... FORMAT 'jsonline' failed with explicit 20301 on Proxy, CN1, and CN2. No rejected output file was created. Plain SELECT retained both values; the source still had 2 rows, SUM(a)=44, and SUM(b)=66.
OK — Repeated empty headings produced with NAME_CONST('',...) failed with 20301 on all three endpoints and created no file.
OK — Unique-alias JSONLINE produced both fields and both rows on all three endpoints. A single empty heading with a distinct y heading remained valid. Duplicate-alias CSV retained both columns and values. A JSONLINE export/load and a CSV export/load control also recovered the expected (11,22) and (33,44) rows.
Failed — With the same duplicate x headings but 0 source rows, JSONLINE OUTFILE returned success on all three endpoints and created a 0-byte file each time. This does not lose a row, but it violates the fix's stated unconditional duplicate-name rejection and its “fail before output” behavior.
Findings
The original nonempty-row silent-data-loss path is fixed on the tested main.
The zero-row boundary remains open. The duplicate check is currently inside constructJSONLine, which receives a batch; the current frontend unit tests construct 1-row batches and do not prove the no-batch path. The observed SQL/file behavior is direct runtime evidence; the missed-batch explanation is a source-based inference. Please validate duplicate output names before opening/writing the export, including when no result batch arrives, and add a zero-row regression.
Large-data regression: not needed. The contract depends on output column names and whether any result batch arrives, not row count beyond the 0/1 boundary, block size, spill, or concurrency.
MOTR / BVT Coverage
A draft SQL case was prepared on an independent MOTR branch, but --record correctly failed at the zero-row assertion (13 statements reached; 12 succeeded, 1 failed). No golden result, commit, push, or PR was produced. The failing expectation was not changed to make the case pass.
The newly created databases, stages, and output files were cleaned up and their absence was checked. The frontend Go tests were not independently rerun here: the macOS checkout lacks its native CGo test artifact, and the available Linux container has Go 1.27.0 while this main requires 1.27.1.
Final Conclusion
Partially fixed. The original 2-row reproduction is fixed on the exact tested main, but duplicate-name JSONLINE export still succeeds for a 0-row result and creates an empty file. Do not treat the complete duplicate-name rejection contract as verified until that boundary is corrected and the MOTR case records and replays successfully.
Tested the merged #30807 fix on isolated current main 6f773c556d4f3177f5373eb193cd576e080b662f (contains merge 52af980b20893c59f72063c37db115bd766bb0d1), using the local MySQL protocol service and a fresh QA database.
Plain SELECT on rows (1,11,22),(2,33,44) returned both duplicate-name values.
Nonempty SELECT a AS x,b AS x ... INTO OUTFILE ... FORMAT 'jsonline' was rejected with 20301 and created no file.
The same duplicate aliases with WHERE id > 999 returned success and created a zero-byte JSONLINE file. This reproduces the open zero-row boundary in the previous report; it does not lose row data, but it violates the unconditional duplicate-name rejection / fail-before-output contract.
A unique-alias zero-row export succeeded with a zero-byte file; source stayed at 2 rows, SUM(a)=44, SUM(b)=66, and the session remained usable.
A separate NAME_CONST('',...) probe was rejected earlier by this build with 20203, so I do not claim a current-main result for duplicate empty headings.
Source inspection at the tested SHA finds duplicate validation in per-batch constructJSONLine; the zero-row SQL result has no batch to enter that function. This is a source-path explanation consistent with the runtime result.
Reproducer command: timeout 90s env PYTHONPATH=/tmp/qa30766/python-deps python /workspace/qa-challenge/fixtures/current_main_6f773_30807_jsonline_duplicate_zero.py (exit 0; output log is in the local QA workspace). The issue remains open and assigned to daviszhen; assignment was not changed.
Runtime: fresh isolated local MatrixOne service built from main aeaa273daf588a9988ba423915d3ae6b8c82124a; executable SHA-256 450363d5ec5e693bdd7ded44565b3b0ab1addcb807d3f9569c5d5eedeb1486e4. SQL ran over the local MySQL protocol endpoint with the QA-only runner.
Observed:
With two source rows, duplicate aliases in SELECT id AS repeated, payload AS repeated ... INTO OUTFILE ... FORMAT 'jsonline' failed with error 20301. No output file was created; the source rows were unchanged.
Unique aliases wrote both rows and both values to JSONLINE.
With an empty source table, the same duplicate aliases returned success and created a zero-byte file. No row value was lost, but the previously reported zero-row rejection gap remains.
Case-distinct aliases CaseKey and casekey produced separate JSON keys.
The zero-row case and current source/runtime identity are newly rechecked on the pinned 2026-10-25 main. The issue remains open; its existing assignee is unchanged.
Activity
XuPeng-SH commentedon Oct 22, 2026
QA follow-up for PR #30807 at head
dca0d807b3a3f382aaa8635716bc23216de18046:The duplicate-name guard still has a silent-data-loss edge for an empty result column name.
duplicatedJSONLineColumnreturns""both when no duplicate exists and when the duplicate name itself is empty, whileconstructJSONLineonly rejectsdup != "". Thus duplicate empty headings (reachable withNAME_CONST('', ...)) pass the guard and the per-row map overwrites one value. The current unit tests cover repeated"x"but not repeated empty names.Please return an explicit found flag/error (or otherwise distinguish absence from an empty name) and add regression coverage for
["", ""]and an empty duplicate alongside another name, including the export error/no-bytes behavior. This is a static source review; I did not run the frontend or SQL repro locally. The submitted PR review also records an isolated helper probe for this boundary.fix(export): reject JSONLINE export with duplicate column names inste…
XuPeng-SH commentedon Oct 22, 2026
QA follow-up for PR #30807, current head
3c384538553c24f63b525dd6fff7db4e6b3eee7b:The previously reported empty-name sentinel bug is addressed in the current source:
duplicatedJSONLineColumnnow returns(name, found), and the writer rejects repeated empty names before serializing rows. Regression cases cover repeated empty names, an empty duplicate followed by another duplicate, a single empty name, no output on rejection, and memory-pool balance. I reviewed the current commit diff and it contains this fix.Validation caveat: the PR author reports the frontend tests and live SQL/export cases passing on the branch. I did not execute those tests. The local checkout is on
mainat460b96365a381e74916b044a99fc9423c33ad3fd, not the PR head, and Go is unavailable in this workspace. Commit status has no checks; the two PR-triggered E2E runs currently listed are Iceberg Connector and Connector/J pool-reset, both in progress and not targeted coverage. Existing issue assignee is alreadyAriznawlll; no assignment change needed. Next verification: obtain exact-head frontend package/required checks and run the regression plus live JSONLINE/CSV controls.fix(export): reject JSONLINE export with duplicate column names inste…
slyunnn commentedon Oct 23, 2026
Regression and extended verification for #30703 (2026-10-23)
Verification Environment
origin/main:bc84bd142600b745503e225cb89cb1526df8d35e—fix(plan): eliminate unobserved sorts below scalar COUNT (#30828). I fetchedorigin/main; the runningmo-servicereports this exact VCS revision, and both CN process binaries match the freshly built binary hash.2 CN / 1 TN / 1 Log service / 1 Proxy. Proxy6001, CN116001, and CN216002were reachable. The SQL below was executed through the real MySQL text protocol, not just connectivity-checked.52af980b20893c59f72063c37db115bd766bb0d1—fix(export): reject JSONLINE export with duplicate column names instead of silently dropping values (#30703).What Was Covered
2-rowSELECT a AS x,b AS x ... INTO OUTFILE ... FORMAT 'jsonline'failed with explicit20301on Proxy, CN1, and CN2. No rejected output file was created. PlainSELECTretained both values; the source still had2rows,SUM(a)=44, andSUM(b)=66.NAME_CONST('',...)failed with20301on all three endpoints and created no file.yheading remained valid. Duplicate-alias CSV retained both columns and values. A JSONLINE export/load and a CSV export/load control also recovered the expected(11,22)and(33,44)rows.xheadings but0source rows, JSONLINEOUTFILEreturned success on all three endpoints and created a0-byte file each time. This does not lose a row, but it violates the fix's stated unconditional duplicate-name rejection and its “fail before output” behavior.Findings
main.constructJSONLine, which receives a batch; the current frontend unit tests construct1-row batches and do not prove the no-batch path. The observed SQL/file behavior is direct runtime evidence; the missed-batch explanation is a source-based inference. Please validate duplicate output names before opening/writing the export, including when no result batch arrives, and add a zero-row regression.0/1boundary, block size, spill, or concurrency.MOTR / BVT Coverage
--recordcorrectly failed at the zero-row assertion (13statements reached;12succeeded,1failed). No golden result, commit, push, or PR was produced. The failing expectation was not changed to make the case pass.1.27.0while thismainrequires1.27.1.Final Conclusion
Partially fixed. The original
2-row reproduction is fixed on the exact testedmain, but duplicate-name JSONLINE export still succeeds for a0-row result and creates an empty file. Do not treat the complete duplicate-name rejection contract as verified until that boundary is corrected and the MOTR case records and replays successfully.XuPeng-SH commentedon Oct 24, 2026
Current-main SQL follow-up (2026-10-24)
Tested the merged #30807 fix on isolated current main
6f773c556d4f3177f5373eb193cd576e080b662f(contains merge52af980b20893c59f72063c37db115bd766bb0d1), using the local MySQL protocol service and a fresh QA database.(1,11,22),(2,33,44)returned both duplicate-name values.SELECT a AS x,b AS x ... INTO OUTFILE ... FORMAT 'jsonline'was rejected with 20301 and created no file.WHERE id > 999returned success and created a zero-byte JSONLINE file. This reproduces the open zero-row boundary in the previous report; it does not lose row data, but it violates the unconditional duplicate-name rejection / fail-before-output contract.SUM(a)=44,SUM(b)=66, and the session remained usable.NAME_CONST('',...)probe was rejected earlier by this build with 20203, so I do not claim a current-main result for duplicate empty headings.Source inspection at the tested SHA finds duplicate validation in per-batch
constructJSONLine; the zero-row SQL result has no batch to enter that function. This is a source-path explanation consistent with the runtime result.Reproducer command:
timeout 90s env PYTHONPATH=/tmp/qa30766/python-deps python /workspace/qa-challenge/fixtures/current_main_6f773_30807_jsonline_duplicate_zero.py(exit 0; output log is in the local QA workspace). The issue remains open and assigned todaviszhen; assignment was not changed.XuPeng-SH commentedon Oct 25, 2026
Fresh-round live SQL follow-up (2026-10-25)
Runtime: fresh isolated local MatrixOne service built from main
aeaa273daf588a9988ba423915d3ae6b8c82124a; executable SHA-256450363d5ec5e693bdd7ded44565b3b0ab1addcb807d3f9569c5d5eedeb1486e4. SQL ran over the local MySQL protocol endpoint with the QA-only runner.Observed:
SELECT id AS repeated, payload AS repeated ... INTO OUTFILE ... FORMAT 'jsonline'failed with error 20301. No output file was created; the source rows were unchanged.CaseKeyandcasekeyproduced separate JSON keys.The zero-row case and current source/runtime identity are newly rechecked on the pinned 2026-10-25 main. The issue remains open; its existing assignee is unchanged.
Reproducer and logs are retained locally:
/workspace/qa-challenge/fixtures/round2-30807-jsonline-rows.sql/workspace/qa-challenge/fixtures/round2-30807-jsonline-empty-boundary.sql/workspace/qa-challenge/logs/round2-aeaa273-30807-jsonline-rows.log/workspace/qa-challenge/logs/round2-aeaa273-30807-jsonline-empty-boundary.log/workspace/qa-challenge/evidence/round2-30807-*.jsonl