Repository navigation
fix: report UNCOMPRESS warnings - #28762
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
1115221 to
051f522
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
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.
## 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.
## 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.
## 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.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #28458
What this PR does / why we need it:
UNCOMPRESScurrently returnsNULLwhen 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
NULLresult 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, SQLNULL, and selection-masked rows remain warning-free.Warnings are accumulated per function invocation with the existing bounded
process.WarningAccumulatorand flushed only after successful evaluation; the shared warning/retry infrastructure is unchanged. All fourUNCOMPRESSoverloads are marked non-foldable so constant-expression diagnostics are generated during execution and can be observed by the followingSHOW 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 WARNINGSfor 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, incrementalgolangci-lintfor./pkg/sql/plan/function(0 new issues), andgo vetwithmolintcompleted.molintexited successfully with an existing diagnostic in unchangedbyte_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.