Skip to content

[Compatibility]: UNCOMPRESS returns NULL for invalid data without MySQL warnings #28458

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

The closed implementation issue #23026 and compression fix #27965 cover value/format compatibility, but no issue was found for invalid-stream warning behavior.

Branch Name

main

Commit ID

a9d3b8b857c44f1249e682c91d4d62a914eb7d20

Other Environment Information

  • Local standalone MatrixOne built from the commit above
  • Reference: MySQL 8.3.0

Actual Behavior

MatrixOne and MySQL both return NULL for invalid UNCOMPRESS() input, but MatrixOne leaves the warning list empty:

SELECT UNCOMPRESS(x'00000000') IS NULL;
SHOW WARNINGS;

MatrixOne:

1
-- no warning rows

MySQL 8.3:

1
Warning 1259 ZLIB: Input data corrupted

A truncated zlib stream produces the same 1259 warning only in MySQL. A forged oversized header produces MySQL warning 1256 (Uncompressed data size too large) while MatrixOne again has no warning.

Each invalid input and its immediately following SHOW WARNINGS was repeated three times. Valid UNCOMPRESS(COMPRESS('abc')) returns abc without warnings in both engines.

The executor currently catches both MySQL-zlib and legacy-DEFLATE decoding errors and appends a NULL result directly. It does not publish the corresponding warning to the session diagnostic area.

Expected Behavior

Invalid compressed input should retain the existing NULL result and emit MySQL-compatible diagnostics so applications that inspect warnings can distinguish corrupt input from an ordinary NULL.

Steps to Reproduce

SELECT UNCOMPRESS(x'00000000') IS NULL;
SHOW WARNINGS;

SELECT UNCOMPRESS(x'03000000789c00') IS NULL;
SHOW WARNINGS;

SELECT UNCOMPRESS(x'ffffffff00') IS NULL;
SHOW WARNINGS;

Controls

  • Valid text and arbitrary binary payloads round-trip in MatrixOne.
  • MatrixOne- and MySQL-produced compressed streams are mutually readable.
  • Empty input and NULL propagation were checked separately.
  • The issue is the missing diagnostic, not decompressed value correctness.

Activity

  1. added this to the MO-202609 milestone on Sep 9, 2026
  2. added theissue type on Sep 9, 2026
  3. self-assigned this
    on Sep 9, 2026
  4. XuPeng-SH commented on Sep 12, 2026

    @XuPeng-SH
    Contributor

    Implemented and opened PR #28762 for this issue (head 2eb115303d19487f20522b8bde53a408ff2b1124).

    Root cause: when both zlib and the legacy raw-DEFLATE fallback rejected an input, UNCOMPRESS discarded the decoder error and returned NULL without a warning. The PR preserves the existing NULL result while reporting MySQL-compatible warnings 1256 (advertised size exceeds the limit), 1258 (decoded output exceeds the advertised capacity), or 1259 (other invalid/truncated input). Successful legacy values, valid zlib, empty, SQL NULL, and masked rows remain warning-free.

    The PR adds bounded per-invocation warning accumulation, prevents constant folding from hiding execution diagnostics, and adds UT plus a registered distributed BVT for constants and mixed column rows. GPT-6 Astra medium reviewed the exact diff and found no blocking issues.

    Validation: formatting, diff checks, and incremental lint passed. Local Go UT/BVT were not run because this macOS checkout lacks valid CGo artifact provenance and unrelated MatrixOne services are active. Exact-head CI is running. The 1258 fixture is supported by MySQL 8.3 source mapping but was not independently black-box tested against MySQL.

  5. added a commit that references this issue on Sep 12, 2026
    ba2b02d
  6. Ariznawlll commented on Sep 14, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • 分支:main
    • commit:07b25969bfea9d4b76d3bf05d5b0497e4f36eba0
    • 部署:本地独立 1 CN / 1 TN / 1 LogService;每轮均重新启动服务后执行。
    • 执行:每项 SQL 回归连续 3 轮,输出逐轮一致。

    原问题验证

    • UNCOMPRESS 对损坏数据返回 NULL 并产生 warning,合法压缩数据仍可解压。

    Happy Path 覆盖

    • 覆盖 COMPRESS/UNCOMPRESS 合法数据,返回原文 ok。

    Unhappy Path 覆盖

    • 覆盖损坏 payload,返回 NULL、warning code 1259;后续合法语句 warning_count 清零。

    白盒验证

    • 以 MOTR 固定 warning 与会话恢复结果。

    回归测试

    测试证据

    • 以上结果均在该 main commit 的独立环境获得;每轮无 stderr,三轮结果一致。

    测试结论

    测试通过。

  7. added 3 commits that reference this issue on Sep 17, 2026
    c29897c
    e88a566
    3959c30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/compatibilitykind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions