Skip to content

Add test: GeoJSONRowOutputFormat::resetFormatterImpl (formatter reuse via formatRow) is untested - #108683

Merged
nihalzp merged 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr108065
Jun 27, 2026
Merged

nihalzp merged 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr108065

Conversation

@clickgapai

@clickgapai clickgapai commented Jun 27, 2026 •

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 #108065.
PR 108065 adds the GeoJSON OUTPUT format (GeoJSONRowOutputFormat) — writing a result set as a single FeatureCollection, one Feature per row — and makes input-format tweaks: a new format_geojson_validate_geometry setting (default true) that gates RFC 7946 shape validation on both read and

1. GeoJSONRowOutputFormat::resetFormatterImpl (formatter reuse via formatRow) is untested
src/Processors/Formats/Impl/GeoJSONRowOutputFormat.cpp:438
Risk: formatRow.cpp:101 calls row_output_format->resetFormatter() per row → IOutputFormat::resetFormatter() → GeoJSONRowOutputFormat::resetFormatterImpl() (GeoJSONRowOutputFormat.cpp:436-440). When a wrapper buffer exists (output_format_json_validate_utf8=1 creates a WriteBufferValidUTF8, or valid_output_on_exception creates a PeekableWriteBuffer), the adaptor reset recreates that wrapper, so line 439 must re-fetch ostr = getWriteBufferPtr(). RISK: if line 439 is …
What's unique vs PR tests: The PR's tests (04402-04412) all run the GeoJSON output formatter once per query (single FeatureCollection) or via the parallel formatter (which throws NOT_IMPLEMENTED for resetFormatterImpl). None reuse a single formatter instance, so none reach resetFormatterImpl; this test reaches it via formatRow over multiple rows.
Tags: -- Tags: no-random-settings — no-random-settings: Test asserts exact JSON output bytes; random injection of output_format_json_* settings could alter quoting/format and flake the comparison.
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)

Version info

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

@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? ✅
src/Processors/Formats/Impl/GeoJSONRowOutputFormat.cpp:438-439 — the body of resetFormatterImpl (base reset + ostr = getWriteBufferPtr()) has zero test coverage; no PR test reuses a single formatter, and parallel formatting throws NOT_IMPLEMENTED for this method.

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: 04413_geojson_output_format_row.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.

@nihalzp nihalzp added the can be tested Allows running workflows for external contributors label Jun 27, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6b70907]

Summary: ✅


AI Review

Summary

This PR adds a focused stateless regression test for formatRow('GeoJSON', ...) reusing GeoJSONRowOutputFormat across rows, including the output_format_json_validate_utf8 wrapper reset path. I found no blocking correctness or test-quality issues; the test targets the claimed formatter-reset behavior and the PR metadata matches a test-only change.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jun 27, 2026
@nihalzp nihalzp self-assigned this Jun 27, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.30% 85.40% +0.10%
Functions 92.60% 92.60% +0.00%
Branches 77.60% 77.60% +0.00%

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

Newly covered by added/modified tests: 768 line(s), 102 function(s) across 140 file(s) · Details

Top files
  • programs/keeper/Keeper.cpp: 259 line(s), 25 function(s)
  • src/Server/KeeperHTTPHandlerFactory.cpp: 100 line(s), 18 function(s)
  • src/Backups/BackupEntriesCollector.cpp: 29 line(s), 2 function(s)
  • src/Interpreters/RewriteCountDistinctVisitor.cpp: 24 line(s)
  • src/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesChanges.h: 14 line(s), 32 function(s)

Full report

@nihalzp
nihalzp added this pull request to the merge queue Jun 27, 2026
Merged via the queue into ClickHouse:master with commit 30f0ce2 Jun 27, 2026
333 of 334 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 27, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…pr108065

Add test: `GeoJSONRowOutputFormat::resetFormatterImpl` (formatter reuse via `formatRow`) 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