Skip to content

Add test: vectorFixedConstant matches-everything shortcut (FixedString column LIKE constant %-run) untested - #107447

Closed
clickgapai wants to merge 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr100479
Closed

clickgapai wants to merge 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr100479

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 #100479.
That PR (1) PR implements MatchImpl::constantVector (previously a stub that threw ILLEGAL_COLUMN) so like/ilike/notLike/notILike/match accept a constant haystack with a non-constant needle (e.g. 'foo' LIKE pattern_column). It also extracts a shared matchOneRow helper used by vectorVector

1. vectorFixedConstant matches-everything shortcut (FixedString column LIKE constant %-run) untested
src/Functions/MatchImpl.h:306
Risk: Dispatch FunctionsStringSearch.h:345-346 routes col_haystack_vector_fixed && col_needle_const to vectorFixedConstant, whose shortcut at MatchImpl.h:304-308 sets every result to !negate. The PR changed the condition at line 304 from needle == "%" || needle == "%%" to impl::likePatternMatchesEverything(needle), and LLVM confirms lines 306-307 executed by no test. Risk: if this shortcut is broken (e.g. !negate flipped, or likePatternMatchesEverything regresses), …
What's unique vs PR tests: The PR's 04327 test exercises the new constantVector (const haystack + needle column) and vectorFixedVector (FixedString haystack + needle COLUMN). This test exercises vectorFixedConstant (FixedString haystack + CONSTANT %-run needle), the only matches-everything branch the PR modified that LLVM marks uncovered.

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? ✅
src/Functions/MatchImpl.h:306-307: for (auto & x : res) x = !negate; inside the vectorFixedConstant matches-everything shortcut (guarded by line 304 is_like && impl::likePatternMatchesEverything(needle)) — correct but covered by zero tests.

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: 04329_like_fixedstring_constant_match_everything.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.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Jun 14, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [464bb53]

Summary: ❌

job_name test_name status info comment
Config Workflow ERROR
Dockers Build (amd) DROPPED
Dockers Build (arm) DROPPED
Dockers Build (multiplatform manifest) DROPPED
Style check DROPPED
Code Review DROPPED
Docs check DROPPED
Docs check (Mintlify) DROPPED
Fast test DROPPED
CI Tests DROPPED

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

clickhouse-gh Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.90% 84.90% +0.00%
Functions 92.30% 92.30% +0.00%
Branches 77.30% 77.30% +0.00%

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

Newly covered by added/modified tests: 316 line(s), 34 function(s) across 132 file(s) · Details

Top files
  • src/Databases/DatabaseReplicated.cpp: 13 line(s)
  • src/Storages/StorageReplicatedMergeTree.cpp: 9 line(s)
  • src/Functions/FunctionsNumericIndexedVector.h: 8 line(s), 3 function(s)
  • src/AggregateFunctions/AggregateFunctionQuantileExact.cpp: 8 line(s)
  • src/Functions/TimeSeries/TimeSeriesTagsFunctionHelpers.cpp: 8 line(s)

Full report

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ alexey-milovidov
❌ ClickGap AI Bot


ClickGap AI Bot seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@zlareb1

zlareb1 commented Aug 10, 2026

Copy link
Copy Markdown
Member

@groeneai can you take this up and open a new PR?

@zlareb1 zlareb1 closed this Aug 10, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

Taking this up. Triaged against master 2850e469dcac84b before answering.

Verified: src/Functions/MatchImpl.h:306 still present; test passes and output matches the reference. Confirmed the gap is real: existing FixedString LIKE tests use substantive patterns (e.g. 01355_ilike.sql:44 uses '%he%o%'), never a pure %-run against a FixedString column.

It will be re-filed as part of an area-grouped PR rather than its own PR, to keep reviewer load down (26 in this batch plus 18 from the earlier one today). Full triage and the grouping plan: #101781 (comment)

@groeneai

Copy link
Copy Markdown
Collaborator

Re-filed as #114260, grouped with the other five functions/types tests from this batch rather than as its own PR, to keep reviewer load down.

Adopted with two changes. The %/%%/%%%%%% spellings collapse to one, since they resolve through the same likePatternMatchesEverything. And the single input row became two: the shortcut at MatchImpl.h:322 is a per-row fill, so one row could not detect a first-row-only regression. A mutation that writes only the first row now reddens the test.

huldarchen pushed a commit to huldarchen/ClickHouse that referenced this pull request Aug 24, 2026
Re-files six test-only coverage PRs that were closed without merging, at the
request of their author. Each test was verified to be non-vacuous by mutating
the exact line it claims to cover and requiring the test to fail; the arms and
their controls are listed below.

- 04201_dot_product_const_nonconst_size_mismatch: the size check in
  arrayDotProduct's one-constant-argument path. The existing 02708_dotProduct
  covers only equal sizes there, and the two-non-constant path throws from a
  different site with a different message.
- 04201_array_index_of_count_equal_nullable_value: the null_map row skip shared
  by has/indexOf/countEqual. Only has() reached it before. Trimmed to
  Nullable(UInt64): with Nullable(String) the nested default never equals an
  array element, so that variant cannot detect the regression.
- 04201_json_extract_keys_and_values_low_cardinality_input: LowCardinality
  stripping for the two functions that force their return type. Only
  JSONExtract exercised it with a non-constant LowCardinality column.
- 04329_like_fixedstring_constant_match_everything: the matches-everything
  shortcut for a FixedString haystack. Existing FixedString LIKE tests all use
  substantive patterns. Keeps one row per template instantiation
  (LIKE / NOT LIKE / ILIKE / match).
- 04146_ipv6_hashing_distinct_values: per-row indexing when hashing an IPv6
  column. 02998_ipv6_hashing repeats a single value, so it cannot detect a
  regression that always reads row 0.
- 04201_windowID_hop_time_overflow: the hop-window overflow guard, which is
  duplicated in the windowID and hop code paths. Neither copy was tested;
  mutating one reddens only its own row, so both are now pinned. Every
  argument carries an explicit timezone because an unqualified DateTime
  literal is read in the session timezone, which CI randomizes across the
  overflow boundary.

Related: ClickHouse#103918
Related: ClickHouse#103922
Related: ClickHouse#103940
Related: ClickHouse#107447
Related: ClickHouse#103885
Related: ClickHouse#103931
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants