Skip to content

Add test: MVTEncode aggregate state serialize/deserialize round-trip is untested - #109601

Merged
fm4v merged 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr106107
Jul 20, 2026
Merged

fm4v merged 1 commit into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr106107

Conversation

@clickgapai

Copy link
Copy Markdown
Contributor

Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.

Adds test coverage for 1 untested code path(s), found during automated review of PR #106107.
That PR Adds native Mapbox Vector Tile encoding: scalar MVTEncodeGeom (project/clip a geometry into tile pixel space), aggregate MVTEncode (assemble a single-layer tile with optional named-tuple properties, feature id and stringify_unsupported), and helpers MVTBoundingBox/MVTBoundingBoxMercator. The

1. MVTEncode aggregate state serialize/deserialize round-trip is untested
src/AggregateFunctions/AggregateFunctionMVTEncode.cpp:593, src/AggregateFunctions/AggregateFunctionMVTEncode.cpp:612
Risk: serialize (AggregateFunctionMVTEncode.cpp:591-598) writes a versioned flat record buffer and deserialize (600-630) reads it back; this path is used by AggregatingMergeTree state columns and by distributed partial aggregation merged across shards. The PR's -State/-Merge test keeps the state in memory (ColumnAggregateFunction) and never serializes (LLVM 593-629 uncovered). Risk: if the state format is broken, tiles stored in AggregatingMergeTree or aggregated across shards would silently …
What's unique vs PR tests: The PR's '-State / -Merge round-trip' test uses an in-query subquery, keeping the state as an in-memory ColumnAggregateFunction (LLVM shows serialize/deserialize 593-629 uncovered). This test persists the state in a MergeTree AggregateFunction column, forcing the serialize-on-INSERT / deserialize-on-SELECT format path the PR never exercises, and additionally covers the has_feature_id min-record-size validation branch.
Try it on ClickHouse Fiddle

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickgapai

Copy link
Copy Markdown
Contributor Author

Pre-PR Validation Gate (per ClickGap pipeline):

a) Deterministic repro? ✅
Test exercises the previously-uncovered branch and passes (correct behaviour).

b) Root cause explained? ✅
AggregateFunctionMVTEncode.cpp:593-597 (serialize body) and 602-629 (deserialize body) — executed only when the state is persisted/exchanged, which no test does.

c) Fix matches root cause? ✅
N/A for coverage gap — this PR adds a regression test, not a fix. Asserts current correct behaviour at the cited line.

d) Test intent preserved? / New tests added? ✅
New regression test added: 04507_mvt_encode_state_serialize.sql.

e) Both directions demonstrated? ✅
Test passes (MATCH) on master proving current correctness; would fail if the cited branch regressed. Single-direction is the correct shape for a coverage gap test.

f) Fix is general, not a narrow patch? ✅
Test asserts the invariant at the cited line — covers the branch, not a specific input shape.

@fm4v fm4v self-assigned this Jul 7, 2026
@fm4v fm4v added the can be tested Allows running workflows for external contributors label Jul 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e817dae]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_debug, parallel) FAIL
04061_spilling_hash_join_overflow_limits FAIL cidb, issue ISSUE EXISTS

AI Review

Summary

This PR adds a stateless query test that persists MVTEncodeState through a stored AggregateFunction column and then compares MVTEncodeMerge after reload against direct MVTEncode, which is the right way to cover the serialize/deserialize path that the existing in-query -State/-Merge test does not exercise. I did not find correctness, coverage-shape, or PR-metadata issues in the current diff.

Missing context / blind spots
  • ⚠️ I could not execute 04507_mvt_encode_state_serialize locally because this checkout has no build directory or runnable binary, and the linked Praktika report currently shows zero completed jobs. A local test run or populated CI report would close that runtime-validation gap.
Final Verdict

✅ No review findings in the current diff. The change looks reasonable pending normal CI execution of the new stateless test.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.02% 86.04% +0.02%
Functions 91.47% 91.47% +0.00%
Branches 78.26% 78.30% +0.04%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 128 line(s), 7 function(s) across 38 file(s) · Details

Top files
  • src/Storages/WindowView/StorageWindowView.cpp: 22 line(s), 1 function(s)
  • src/AggregateFunctions/AggregateFunctionMVTEncode.cpp: 21 line(s), 3 function(s)
  • src/Analyzer/Resolve/QueryAnalyzer.cpp: 6 line(s)
  • src/Functions/FunctionsBitmap.h: 6 line(s)
  • src/Functions/bech32.cpp: 6 line(s)

Full report

@fm4v
fm4v added this pull request to the merge queue Jul 20, 2026
Merged via the queue into ClickHouse:master with commit 22b4e85 Jul 20, 2026
173 of 176 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 20, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…pr106107

Add test: `MVTEncode` aggregate state `serialize`/`deserialize` round-trip is untested
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants