Skip to content

Enrich MVT tests: verify MVTEncode output against the Mapbox Vector Tile spec - #108929

Merged
Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/mvt-test-enrichment
Jul 1, 2026
Merged

Algunenano merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/mvt-test-enrichment

Conversation

@groeneai

@groeneai groeneai commented Jun 30, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #106107

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

...

Description

Follow-up to #106107 (merged), requested by @ fm4v: enrich the MVT-function tests with boundary values and equivalence classes, and verify the output against the standard.

The existing tests (04299_mvt_encode, 04300_mvt_clip) assert MVTEncode output as opaque hex. This adds 04345_mvt_encode_spec_conformance, which decodes the bytes produced by MVTEncode back through the official Mapbox Vector Tile 2.1 wire schema (vector_tile.proto, added under format_schemas/) using the Protobuf format, then asserts the decoded structure. So the output is checked to be correct according to the spec, not merely stable.

What it verifies:

  • Against the standard (vector-tile-spec 2.1, §4.3.5 worked examples). The geometry command streams reproduce byte-for-byte: Point (25,17) -> [9,50,34]; Linestring -> [9,4,4,18,0,16,16,0]; Polygon -> [9,6,12,18,10,12,24,44,15]; MultiLinestring -> [9,4,4,18,0,16,16,0,9,17,17,10,4,8]. The layer envelope decodes to version = 2, the requested name/extent and the property keys (§4.1).
  • Equivalence classes. Geometry kinds (point/line/polygon-with-hole/multilinestring, two ClosePath for a hole); each property type -> its Value variant (string/float/double/sint/uint/bool, plus Date->uint_value, Date32->sint_value); feature_id_name -> Feature.id excluded from tags; value interning (shared -> pool size 1, distinct -> pool size 2); stringify_unsupported -> exact decimal string_value.
  • Boundary values. zoom 0 and 32, extent extremes (1 and 1073741824), world-origin pixel.

No existing assertions are weakened. The new assertions are demonstrated to fail on a wrong command stream (a one-unit deviation flips the check), so an encoder regression would be caught.

The test is a parallel-safe .sh test using clickhouse-local with a unique temp filename, and is tagged no-fasttest because the Protobuf format requires the protobuf contrib.

Version info

  • Merged into: 26.7.1.348 (included in 26.7 and later)

….proto

The existing MVT tests (04299/04300) assert the encoder output as opaque
hex. This adds a test that decodes the bytes produced by MVTEncode back
through the official Mapbox Vector Tile 2.1 wire schema and asserts the
decoded structure, so the output is verified to be correct according to the
standard rather than merely stable.

The geometry command streams are checked against the worked examples in the
specification (vector-tile-spec 2.1, section 4.3.5): the point, linestring,
polygon and multilinestring examples reproduce byte-for-byte. The test also
covers equivalence classes (each property type to its Value variant, the
feature id, value interning, stringify_unsupported) and boundary values
(zoom 0 and 32, extent extremes), and the assertions are demonstrated to
fail on a wrong command stream.

Requested by @ fm4v on PR ClickHouse#106107.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? N/A — no failure being fixed. The added test is deterministic: it ran to completion (EXIT=0), every spec-conformance assertion returns 1, and MVTEncode is not order-dependent for the single-feature cases used.
b Root cause explained? N/A — test-only enrichment, no bug.
c Fix matches root cause? N/A — test-only enrichment, no bug.
d Test intent preserved / new tests added? Yes. New test 04345_mvt_encode_spec_conformance added; no existing assertion in 04299/04300 is changed or weakened. It strengthens coverage: decodes output through the official vector_tile.proto and asserts structure (vs the existing opaque-hex comparison).
e Both directions demonstrated? Yes. Negative control: the spec command-stream assertions return 1 for the correct value and 0 for a one-unit-off value, so an encoder regression in the command stream would be caught.
f Fix is general across code paths? N/A — test-only addition, not a code bug.
g Fix generalizes across inputs (params/datatypes/wrappers)? The test deliberately spans the input matrix: geometry kinds (point/line/polygon-with-hole/multilinestring), every property Value variant (string/float/double/sint/uint/bool, Date→uint, Date32→sint), feature-id present, value interning (shared/distinct), stringify_unsupported, and boundaries (zoom 0/32, extent 1 and 1073741824).
h Backward compatible? (maintainer-approved exception only) N/A — test-only addition; no setting/format/behavior change.
i Invariants and contracts preserved? N/A — test-only addition; no source code touched.

Session id: cron:clickhouse-worker-slot-4:20260630-111700

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @fm4v — the enrichment you asked for on #106107. Decodes MVTEncode output through the official vector_tile.proto and asserts it against the spec's §4.3.5 worked examples (byte-for-byte), plus equivalence classes and boundary values; no existing assertion weakened.

@Algunenano Algunenano self-assigned this Jun 30, 2026
@Algunenano Algunenano added the can be tested Allows running workflows for external contributors label Jun 30, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [30db141]

Summary: ❌

job_name test_name status info comment
Stress test (amd_tsan) FAIL
Hung check failed, possible deadlock found FAIL cidb, issue
Stress test (arm_tsan) FAIL
Hung check failed, possible deadlock found FAIL cidb, issue

AI Review

Summary

This PR is a test-only follow-up for MVTEncode: it adds a stateless shell test that writes encoded tiles as RawBLOB, decodes them through the Mapbox Vector Tile protobuf schema with ProtobufSingle, and checks the layer envelope, geometry command streams, property value variants, feature ids, value interning, unsupported-value stringification, and boundary values. I found no correctness or test-harness issues that need inline comments.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 30, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.74% 85.76% +0.02%
Functions 91.47% 91.47% +0.00%
Branches 78.34% 78.39% +0.05%

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

Newly covered by added/modified tests: 141 line(s), 32 function(s) across 60 file(s) · Details

Top files
  • src/Interpreters/HashJoin/HashJoin.cpp: 10 line(s)
  • src/Storages/ObjectStorageQueue/ObjectStorageQueueSource.cpp: 8 line(s)
  • src/Functions/if.cpp: 7 line(s)
  • src/AggregateFunctions/AggregateFunctionQuantileDD.cpp: 5 line(s)
  • src/Functions/FunctionsCodingIP.cpp: 5 line(s)

Full report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 30db141

CI fully finished (Finish Workflow: success; Mergeable Check: pass). This PR adds a parallel-safe MVT spec-conformance .sh test + format schema (per @ fm4v's review). Neither failure is PR-caused.

Check / test Reason Owner
Stress test (amd_tsan) + (arm_tsan) / "Hung check failed, possible deadlock found" deadlock (chronic hung-check family, 600+ distinct PRs / 30d; unrelated to a stateless MVT test addition) #108212 (ours, merged 2026-06-28) / #105905 (ours, open)
PR aggregator rollup of the hung-check rows above

Session id: cron:our-pr-ci-monitor:20260630-163000

@Algunenano
Algunenano added this pull request to the merge queue Jul 1, 2026
Merged via the queue into ClickHouse:master with commit 36cdb5f Jul 1, 2026
171 of 174 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 1, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…enrichment

Enrich MVT tests: verify MVTEncode output against the Mapbox Vector Tile spec
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-ci 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