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
[Feature]: MODUMP should honor file suffix for jsonline/parquet output instead of always writing CSV #30570
MODUMP QUERY_RESULT '<id>' INTO '<path>' always writes CSV regardless of the output file's extension. export.go already has full support for jsonline and parquet via inferFormatFromSuffix / validateExportFormat, but the MODUMP path never calls them, so ExportFormat stays empty and getExportFormat() falls back to "csv".
Actual behavior
modump query_result '<id>' into '/tmp/out.jsonline'; -- writes CSV
modump query_result '<id>' into '/tmp/out.parquet'; -- writes CSV (magic bytes are "id,n...", not "PAR1")
Both files contain CSV text, despite their extensions.
Proposed solution
Make MODUMP honor the output file suffix the same way SELECT ... INTO does: call inferFormatFromSuffix (and validateExportFormat) in the MODUMP path (e.g. in doDumpQueryResult in pkg/frontend/query_result.go) so .jsonl/.jsonline/.ndjson produce JSON Lines and .parquet produces Parquet.
Additional information
Root cause: pkg/frontend/query_result.go (doDumpQueryResult) never sets ExportParam.ExportFormat nor calls validateExportFormat; the format inference logic lives in pkg/frontend/export.go but is only wired into the SELECT ... INTO / EXPORT path.
The MODUMP grammar (mo_dump_stmt) has no FORMAT keyword, so suffix-based inference is the natural mechanism to reuse.
QA on merged main b888c218fb3a4f094bb8417288a45c47402e5635 (#31466): our local parser checks passed (3 top-level tests, 26 RUN entries); resource limits prevented local writer/readback and error-path connection-reuse verification.
Subsequent independent verification by Ariznawlll on f847803 is documented in #30570 (comment): CSV, three JSON Lines suffixes and Parquet were each exported and read back 3/3; invalid query IDs left no file and the connection recovered. The focused MOTR case passed 3/3; the full MOTR suite was not run. These are the reporter's results, not local results from this QA environment.
A separate binary-reader interoperability defect remains tracked in #31495: on f847803, the reporter found BINARY/VARBINARY with non-UTF-8 bytes exported as Parquet UTF-8 strings and failed PyArrow readback through both MODUMP and SELECT INTO OUTFILE. BLOB and ASCII controls passed, and MO LOAD recovered the bytes. Do not generalize the suffix verification to all binary Parquet data.
Activity
fix(frontend,plan): restore FILEPATH in SHOW CREATE for file-based ex…
fix(frontend,plan): restore FILEPATH in SHOW CREATE for file-based ex…
fix(plan): redact object-store credentials in SHOW CREATE FILEPATH op…
fix(frontend,plan): restore FILEPATH in SHOW CREATE for file-based ex…
fix(plan): redact object-store credentials in SHOW CREATE FILEPATH op…
fix(frontend,plan): restore FILEPATH in SHOW CREATE for file-based ex…
XuPeng-SH commentedon Oct 28, 2026
QA on merged main
b888c218fb3a4f094bb8417288a45c47402e5635(#31466): our local parser checks passed (3 top-level tests, 26 RUN entries); resource limits prevented local writer/readback and error-path connection-reuse verification.Subsequent independent verification by Ariznawlll on
f847803is documented in #30570 (comment): CSV, three JSON Lines suffixes and Parquet were each exported and read back 3/3; invalid query IDs left no file and the connection recovered. The focused MOTR case passed 3/3; the full MOTR suite was not run. These are the reporter's results, not local results from this QA environment.A separate binary-reader interoperability defect remains tracked in #31495: on
f847803, the reporter found BINARY/VARBINARY with non-UTF-8 bytes exported as Parquet UTF-8 strings and failed PyArrow readback through both MODUMP and SELECT INTO OUTFILE. BLOB and ASCII controls passed, and MO LOAD recovered the bytes. Do not generalize the suffix verification to all binary Parquet data.Ariznawlll commentedon Oct 28, 2026
测试版本
f847803802289b2b2d0df4f0a2f842c2804b823a,已核对修复 #31466 的 merge commitb888c218fb3a4f094bb8417288a45c47402e5635在祖先链。原问题验证
开启结果保存后执行公开查询,再对同一 query ID 执行 MODUMP。CSV、
.jsonl、.jsonline、.ndjson和.parquet各 3 次均成功;直接读取文件内容:CSV 为列名id,name和行7,hello;三种 JSON Lines 均为{"id":7,"name":"hello"};使用 PyArrow 独立读取 Parquet 得到相同字段和值,确认不是仅凭扩展名或魔数判断。Happy Path 覆盖
上述五种格式各 3/3,源查询返回
(7, hello);导出后临时目录按每轮清理。save_query_result在本次独立连接设置,不更改全局配置。Unhappy Path 覆盖
无效 query ID 3/3 返回 20440(query id not found),没有创建目标文件;同一连接随后
SELECT 1返回 1。此次无写表失败原子性场景;未验证无效 UTF-8 和远程对象存储。白盒验证
本轮以 MySQL 协议、真实文件和 PyArrow 读取为黑盒,未新增 Go UT/race;修复 PR 中有格式写出与 Parquet 读回定向 UT。
回归测试
MOTR #284 的 issue_30570_modump_formats.py 使用本机文件系统及 PyArrow,显式设置
MOTR_LOCAL_FILE_TESTS=1后定向 3/3;未配置时标记跳过,不把跳过当通过。未运行完整 MOTR suite。测试证据
修复 PR 的 CI 包含通过与 skipped 项;MOTR 新 head CI 在发布时尚未报告,不能声明完整 CI 通过。本地独立读取、异常和 MOTR 三轮结果如上。
测试结论
测试通过。