Skip to content

fix: report UNCOMPRESS warnings - #28762

Merged
XuPeng-SH merged 3 commits into
mainfrom
codex/issue-28458-uncompress
Sep 12, 2026
Merged

XuPeng-SH merged 3 commits into
mainfrom
codex/issue-28458-uncompress

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

Fixes #28458

What this PR does / why we need it:

UNCOMPRESS currently returns NULL when both its zlib decoder and the legacy raw-DEFLATE fallback reject an input, but drops the decoder error. This diverges from MySQL-compatible behavior because callers cannot inspect the corresponding warning.

This change preserves the primary zlib error while keeping the legacy fallback. If both decoders reject a non-NULL input, it returns the existing NULL result and emits exactly one warning: 1256 for an advertised output size above the result limit, 1258 when decompression exceeds the advertised output capacity, or 1259 for other malformed/truncated input. Successful zlib and legacy values, empty input, SQL NULL, and selection-masked rows remain warning-free.

Warnings are accumulated per function invocation with the existing bounded process.WarningAccumulator and flushed only after successful evaluation; the shared warning/retry infrastructure is unchanged. All four UNCOMPRESS overloads are marked non-foldable so constant-expression diagnostics are generated during execution and can be observed by the following SHOW WARNINGS.

The regression coverage checks warning code/message and NULL results for all three error classes, valid zlib and legacy inputs, empty/NULL/masked rows, mixed rows, and exact warning totals with bounded retention. A distributed case checks immediate SHOW WARNINGS for constant expressions and a mixed BLOB column; its test database is isolated and dropped without changing the caller's current schema.

Performance note: valid row decoding keeps the existing decode/fallback path and adds no extra decode pass or per-row sink call. Invalid rows incur bounded warning-accumulation work. Marking constant expressions non-foldable necessarily moves their decode work from planning to execution so warnings are not lost; no result cache is introduced.

Validation: gofmt, git diff --check, incremental golangci-lint for ./pkg/sql/plan/function (0 new issues), and go vet with molint completed. molint exited successfully with an existing diagnostic in unchanged byte_like_wildcard_search.go. Focused Go UT and distributed BVT were not run locally: this macOS checkout lacks valid CGo native-artifact provenance, and an unrelated MatrixOne service is already active. These tests must be confirmed by CI for the exact PR head.

Compatibility evidence note: the issue's MySQL 8.3 reproduction establishes warnings 1256 and 1259. The 1258 mapping and fixture are supported by the MySQL 8.3 implementation, but that fixture was not independently executed against a MySQL server.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Sep 12, 2026
@mergify mergify Bot added the kind/bug Something isn't working label Sep 12, 2026

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 051f52243cc3df332e79e9ad8e467139b7710b30 against base 0d701bb966f3dbc313d6659baec1c47762d1c186.

No blocking findings in this revision. The implementation closes the missing-diagnostic behavior in #28458 without changing successful zlib/legacy decoding or NULL results:

  • The primary zlib error is retained across the legacy fallback; only rejection by both decoders adds a diagnostic. The size-limit sentinel and bounded-writer error distinguish 1256/1258 from generic 1259 without classifying unrelated invalid-input errors as size failures.
  • NULL, empty, valid, legacy, and selection-masked inputs remain warning-free. Diagnostic retention is bounded independently of the exact warning count; flushing happens once after successful function evaluation, so an append failure does not publish a partial invocation's diagnostics.
  • All overloads are non-foldable, and the executor consumes this flag for runtime/prepared evaluation. This is appropriate for execution-time warnings. MySQL's UNCOMPRESS warnings are not among the errors promoted by its strict-mode handler, so introducing SQL_MODE-dependent rejection here would be incorrect. See UNCOMPRESS implementation and strict-mode handler.
  • Valid column inputs gain no additional decompression pass or per-row warning-sink call. Constant expressions now perform runtime decoding, an explicitly documented tradeoff; this review does not establish benchmark equivalence for queries repeatedly decompressing a large constant.

The focused tests cover classification, mixed rows, legacy controls, selection, and exact count versus retained diagnostics; the BVT checks observable warnings and isolated teardown. Reused the successful exact-head UT, SCA, coverage, build, and both active BVT checks in CI run 34690264891; no broad local rerun was performed.

Non-blocking follow-up: a prepared-statement regression that alternates corrupt/valid/NULL parameters and inspects SHOW WARNINGS after each execution would preserve the execution-time warning contract more directly than the overload-flag assertion alone.

@XuPeng-SH
XuPeng-SH merged commit ba2b02d into main Sep 12, 2026
22 of 25 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/issue-28458-uncompress branch September 12, 2026 12:36
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

Fixes matrixorigin#28458

## What this PR does / why we need it:

`UNCOMPRESS` currently returns `NULL` when both its zlib decoder and the
legacy raw-DEFLATE fallback reject an input, but drops the decoder
error. This diverges from MySQL-compatible behavior because callers
cannot inspect the corresponding warning.

This change preserves the primary zlib error while keeping the legacy
fallback. If both decoders reject a non-NULL input, it returns the
existing `NULL` result and emits exactly one warning: 1256 for an
advertised output size above the result limit, 1258 when decompression
exceeds the advertised output capacity, or 1259 for other
malformed/truncated input. Successful zlib and legacy values, empty
input, SQL `NULL`, and selection-masked rows remain warning-free.

Warnings are accumulated per function invocation with the existing
bounded `process.WarningAccumulator` and flushed only after successful
evaluation; the shared warning/retry infrastructure is unchanged. All
four `UNCOMPRESS` overloads are marked non-foldable so
constant-expression diagnostics are generated during execution and can
be observed by the following `SHOW WARNINGS`.

The regression coverage checks warning code/message and NULL results for
all three error classes, valid zlib and legacy inputs, empty/NULL/masked
rows, mixed rows, and exact warning totals with bounded retention. A
distributed case checks immediate `SHOW WARNINGS` for constant
expressions and a mixed BLOB column; its test database is isolated and
dropped without changing the caller's current schema.

Performance note: valid row decoding keeps the existing decode/fallback
path and adds no extra decode pass or per-row sink call. Invalid rows
incur bounded warning-accumulation work. Marking constant expressions
non-foldable necessarily moves their decode work from planning to
execution so warnings are not lost; no result cache is introduced.

Validation: `gofmt`, `git diff --check`, incremental `golangci-lint` for
`./pkg/sql/plan/function` (0 new issues), and `go vet` with `molint`
completed. `molint` exited successfully with an existing diagnostic in
unchanged `byte_like_wildcard_search.go`. Focused Go UT and distributed
BVT were not run locally: this macOS checkout lacks valid CGo
native-artifact provenance, and an unrelated MatrixOne service is
already active. These tests must be confirmed by CI for the exact PR
head.

Compatibility evidence note: the issue's MySQL 8.3 reproduction
establishes warnings 1256 and 1259. The 1258 mapping and fixture are
supported by the MySQL 8.3 implementation, but that fixture was not
independently executed against a MySQL server.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

Fixes matrixorigin#28458

## What this PR does / why we need it:

`UNCOMPRESS` currently returns `NULL` when both its zlib decoder and the
legacy raw-DEFLATE fallback reject an input, but drops the decoder
error. This diverges from MySQL-compatible behavior because callers
cannot inspect the corresponding warning.

This change preserves the primary zlib error while keeping the legacy
fallback. If both decoders reject a non-NULL input, it returns the
existing `NULL` result and emits exactly one warning: 1256 for an
advertised output size above the result limit, 1258 when decompression
exceeds the advertised output capacity, or 1259 for other
malformed/truncated input. Successful zlib and legacy values, empty
input, SQL `NULL`, and selection-masked rows remain warning-free.

Warnings are accumulated per function invocation with the existing
bounded `process.WarningAccumulator` and flushed only after successful
evaluation; the shared warning/retry infrastructure is unchanged. All
four `UNCOMPRESS` overloads are marked non-foldable so
constant-expression diagnostics are generated during execution and can
be observed by the following `SHOW WARNINGS`.

The regression coverage checks warning code/message and NULL results for
all three error classes, valid zlib and legacy inputs, empty/NULL/masked
rows, mixed rows, and exact warning totals with bounded retention. A
distributed case checks immediate `SHOW WARNINGS` for constant
expressions and a mixed BLOB column; its test database is isolated and
dropped without changing the caller's current schema.

Performance note: valid row decoding keeps the existing decode/fallback
path and adds no extra decode pass or per-row sink call. Invalid rows
incur bounded warning-accumulation work. Marking constant expressions
non-foldable necessarily moves their decode work from planning to
execution so warnings are not lost; no result cache is introduced.

Validation: `gofmt`, `git diff --check`, incremental `golangci-lint` for
`./pkg/sql/plan/function` (0 new issues), and `go vet` with `molint`
completed. `molint` exited successfully with an existing diagnostic in
unchanged `byte_like_wildcard_search.go`. Focused Go UT and distributed
BVT were not run locally: this macOS checkout lacks valid CGo
native-artifact provenance, and an unrelated MatrixOne service is
already active. These tests must be confirmed by CI for the exact PR
head.

Compatibility evidence note: the issue's MySQL 8.3 reproduction
establishes warnings 1256 and 1259. The 1258 mapping and fixture are
supported by the MySQL 8.3 implementation, but that fixture was not
independently executed against a MySQL server.
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

Fixes matrixorigin#28458

## What this PR does / why we need it:

`UNCOMPRESS` currently returns `NULL` when both its zlib decoder and the
legacy raw-DEFLATE fallback reject an input, but drops the decoder
error. This diverges from MySQL-compatible behavior because callers
cannot inspect the corresponding warning.

This change preserves the primary zlib error while keeping the legacy
fallback. If both decoders reject a non-NULL input, it returns the
existing `NULL` result and emits exactly one warning: 1256 for an
advertised output size above the result limit, 1258 when decompression
exceeds the advertised output capacity, or 1259 for other
malformed/truncated input. Successful zlib and legacy values, empty
input, SQL `NULL`, and selection-masked rows remain warning-free.

Warnings are accumulated per function invocation with the existing
bounded `process.WarningAccumulator` and flushed only after successful
evaluation; the shared warning/retry infrastructure is unchanged. All
four `UNCOMPRESS` overloads are marked non-foldable so
constant-expression diagnostics are generated during execution and can
be observed by the following `SHOW WARNINGS`.

The regression coverage checks warning code/message and NULL results for
all three error classes, valid zlib and legacy inputs, empty/NULL/masked
rows, mixed rows, and exact warning totals with bounded retention. A
distributed case checks immediate `SHOW WARNINGS` for constant
expressions and a mixed BLOB column; its test database is isolated and
dropped without changing the caller's current schema.

Performance note: valid row decoding keeps the existing decode/fallback
path and adds no extra decode pass or per-row sink call. Invalid rows
incur bounded warning-accumulation work. Marking constant expressions
non-foldable necessarily moves their decode work from planning to
execution so warnings are not lost; no result cache is introduced.

Validation: `gofmt`, `git diff --check`, incremental `golangci-lint` for
`./pkg/sql/plan/function` (0 new issues), and `go vet` with `molint`
completed. `molint` exited successfully with an existing diagnostic in
unchanged `byte_like_wildcard_search.go`. Focused Go UT and distributed
BVT were not run locally: this macOS checkout lacks valid CGo
native-artifact provenance, and an unrelated MatrixOne service is
already active. These tests must be confirmed by CI for the exact PR
head.

Compatibility evidence note: the issue's MySQL 8.3 reproduction
establishes warnings 1256 and 1259. The 1258 mapping and fixture are
supported by the MySQL 8.3 implementation, but that fixture was not
independently executed against a MySQL server.

This branch was previously deployed

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

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants