Skip to content

Tighten coverage tests added in #103456 - #103618

Merged
alexey-milovidov merged 2 commits into
masterfrom
coverage-test-fixes-2026-04-27
Apr 29, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
coverage-test-fixes-2026-04-27

Conversation

@fm4v

@fm4v fm4v commented Apr 27, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #103456 (which has been merged). That PR added 28 stateless tests
generated by an AI on lowest-thinking level. A focused review surfaced several
weak or wrong expected outputs that were codified rather than tested. This PR
tightens the worst offenders so the tests actually discriminate between correct
and broken behaviour.

Per-test summary:

  • 04121 JSONExtract Variant — replaced Variant(String, Int64, Float64)

  • 04128 sequenceNextNode — original two-matcher cases all returned \N
    because the base condition (event='A') and chain[0] (event='B') are
    mutually exclusive on the same row, so getBaseIndex never selected a base.
    Rewritten so the direction × base matrix produces six distinct non-NULL
    results plus a non-trivial GROUP BY merge.

  • 04131 prometheusQuery parser — INSERT is not supported by the
    TimeSeries engine (NOT_IMPLEMENTED). Added a scope note clarifying that
    count() == 0 assertions exercise only the parser surface and an evaluator
    regression on an empty selector would need a separate integration test.

  • 04132 ColumnSparse parts_columns — SELECT name, serialization_kind
    returned the part name (all_1_1_0) three times, giving no information
    about which column got which serialization. Changed to SELECT column, serialization_kind which now returns id Default / s Sparse / v Sparse.

  • 04134 SingleValueDataGenericWithColumn — removed the misleading
    any_value of Tuple via ORDER BY LIMIT 1 section: ORDER BY ... LIMIT 1
    invokes the sort path, not any()/anyLast(). Header now states explicitly
    that any/anyLast are excluded because they return unspecified rows under
    parallelism.

  • 04135 BSONEachRow coerce — original Int32(=42) -> Int8 writes a value
    that fits in Int8, so a silent-truncation regression would have passed.
    Switched to 200::Int32 -> Int8 and codified the resulting -56 wrap
    explicitly. Tightened the error matcher from Code: [0-9]* to Code: [0-9]+.

  • 04140 Parquet — added profile-event assertions for the pushdown /
    pruning sections that previously only checked result correctness:

    • ParquetPrunedRowGroups: 5000 rows / 500 per group → 10 groups, expect
      read=1 pruned=9 for WHERE n BETWEEN 100 AND 200.
    • ParquetDecodingTasks: single-column read should issue fewer decoding
      tasks than reading all columns.
      Also asserts result equivalence with input_format_parquet_filter_push_down=0.

All seven tests verified locally against clickhouse local 26.5.1.111.

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):

Not for changelog (changelog entry is not required)

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.5.1.159

…04135, 04140)

Several of the tests added in PR #103456 codified weak or wrong expected output
because they were generated by a low-reasoning agent that accepted whatever the
server returned. This commit fixes the assertions so the tests actually
discriminate between correct and broken behaviour.

- 04121: Replace `JSONExtract('{"x": 3.14}', 'x', 'Variant(String, Int64, Float64)')`
  which returned 3 (silent truncation) with `Variant(String, Float64)` which
  returns 3.14. The truncation case is tracked separately in
  #103617.

- 04128: The original `sequenceNextNode` matrix used `(time, event, event='A',
  event='B')` arguments where `event='A'` is the base condition and `event='B'`
  is chain[0]; both must be true on the same row, which is impossible for
  mutually exclusive predicates. Every two-matcher case returned `\N`,
  exercising no traversal. Rewritten so the direction x base matrix produces
  six distinct non-NULL results plus a non-trivial GROUP BY merge.

- 04131: PromQL evaluator coverage for selector-based queries (rate, by/without,
  group_left/right, prometheusQueryRange) is unverifiable because the
  `TimeSeries` engine does not support direct INSERT (`NOT_IMPLEMENTED`). Added
  a scope note clarifying that those `count() == 0` assertions exercise only
  the parser surface and an evaluator regression on an empty selector would
  need a separate integration test.

- 04132: Replaced `SELECT name, serialization_kind FROM system.parts_columns`
  with `SELECT column, serialization_kind`. `name` is the part name
  (`all_1_1_0`), so the original query returned three identical part-name rows
  and gave no information about which column got which serialization. The
  fixed query returns `id Default / s Sparse / v Sparse`.

- 04134: Removed the misleading `any_value of Tuple via ORDER BY LIMIT 1`
  section: it was claimed to "still exercise the tuple code path
  deterministically" but `ORDER BY val LIMIT 1` invokes the sort path, not
  `any()/anyLast()` over `SingleValueDataGenericWithColumn`. The header now
  states explicitly that `any/anyLast` are excluded because they return
  unspecified rows under parallelism. The empty-input case is renamed and
  asserts only `min/max/argMin/argMax`.

- 04135: The original `Int32 -> Int8` coerce used value 42, which fits in
  `Int8`, so a silent-truncation regression would have passed. Switched to
  value 200 and codified the resulting `-56` wrap explicitly so the test now
  detects regressions in the narrowing path. Tightened the error matcher
  from `Code: [0-9]*` to `Code: [0-9]+`.

- 04140: The original "filter pushdown" and "column pruning" sections only
  asserted result correctness; a regression that disabled pushdown or read
  all columns would still pass. Added profile-event assertions:
  ParquetPrunedRowGroups for row-group pruning (5000 rows / 500 per group =>
  10 groups, expecting `read=1 pruned=9`) and ParquetDecodingTasks for
  column pruning (single-column read should issue fewer decoding tasks
  than reading all columns). Also asserts result equivalence with
  `input_format_parquet_filter_push_down=0`.

Discovered while reviewing #103456. The PR has been merged, so this lands as
follow-up rather than amend.
@clickhouse-gh

clickhouse-gh Bot commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [842cf0a]

Summary: ✅


AI Review

Summary

This PR tightens several recently added stateless tests so they validate real behavior instead of weak/non-discriminating outputs, mainly in JSONExtract, sequenceNextNode, ColumnSparse, SingleValueDataGenericWithColumn, BSONEachRow, and Parquet profile-event checks. I did not find correctness, safety, or rollout issues in the proposed test changes.

ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict
  • Status: ✅ Approve

CI failure: under parallel Parquet decode, --print-profile-events emits
ParquetDecodingTasks (and other counters) on multiple lines, one per
thread/batch. The original awk patterns assumed a single line per counter,
so:

- The pushdown awk picked the LAST counter line (truncating partial sums).
- The column-pruning ONE=$(...) captured a multiline string ('1\n1'),
  which then failed the `[ "$ONE" -lt "$ALL" ]` numeric test as a syntax
  error and let the script proceed past the assertion silently.

Fix:
- Sum counter values across all matching lines.
- For pushdown, emit a binary "pruned" / "not pruned" verdict instead of
  the exact counts, since the work distribution across threads is not
  pinned. A regression that disables pushdown would still flip the
  verdict (pruned > 0 -> 0).
- For column pruning, sum decoding tasks for one-column and all-column
  reads and assert the former is strictly smaller.

CI report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=103618&sha=0bb58ad618e1fe94ae773f5fc391540acc7d568d&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%2C%201%2F2%29

See #103618
@alexey-milovidov alexey-milovidov self-assigned this Apr 28, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Apr 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 28, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Apr 29, 2026
Merged via the queue into master with commit dcfc9aa Apr 29, 2026
165 checks passed
@alexey-milovidov
alexey-milovidov deleted the coverage-test-fixes-2026-04-27 branch April 29, 2026 03:00
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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