Skip to content

Fix for whitespace bug in LIKE formatting - #101931

Merged
alexey-milovidov merged 8 commits into
masterfrom
yarik/fix-ilike-trailing-space-parsing
May 19, 2026
Merged

alexey-milovidov merged 8 commits into
masterfrom
yarik/fix-ilike-trailing-space-parsing

Conversation

@yariks5s

@yariks5s yariks5s commented Apr 7, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fixes a small whitespace bug during parsing of LIKE statement. Closes #101877

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.5.1.794

@clickhouse-gh

clickhouse-gh Bot commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [28a2d60]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) FAIL
02180_group_by_lowcardinality FAIL cidb
02345_implicit_transaction NOT_FAILED cidb
02435_rollback_cancelled_queries NOT_FAILED cidb

AI Review

Summary

This PR fixes malformed SQL formatting where LIKE in ASTDropQuery::formatQueryImpl and ASTShowColumnsQuery::formatQueryImpl missed the trailing space before the quoted pattern, and adds focused stateless coverage for LIKE/ILIKE and NOT LIKE/NOT ILIKE variants. The previously reported symmetric SHOW COLUMNS concern is addressed in the current head, and I did not find any remaining correctness or safety issues in the changed surface.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Apr 7, 2026
@thevar1able thevar1able self-assigned this Apr 7, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

The 02346_text_index_bug101913 test failure is fixed by #102108 (already merged). Please rebase or merge master to pick up the fix.

@alexey-milovidov

Copy link
Copy Markdown
Member

The MSan stress test failure (MemorySanitizer: use-of-uninitialized-value, STID 4179-5154 or 4148-3044) is a known pre-existing issue unrelated to this PR. Fix: #102158

Comment thread src/Parsers/ASTDropQuery.cpp Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member

The flaky check failure is fixed in #102148, let's update the branch.

Address review: apply the same fix symmetrically to
`ASTShowColumnsQuery::formatQueryImpl`, which used `" LIKE"` (no trailing
space) before `quoteString(like)` and produced malformed output like
`LIKE'%x%'`. Extend the stateless `formatQuery` test to cover this path.
@alexey-milovidov

Copy link
Copy Markdown
Member

This was fixed by #105146. Let's update the branch.

@alexey-milovidov alexey-milovidov changed the title Fix for whitespace bug in LIKE parsing Fix for whitespace bug in LIKE formatting May 17, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LGTM.

@alexey-milovidov alexey-milovidov self-assigned this May 17, 2026
@clickhouse-gh

clickhouse-gh Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.20% 84.20% +0.00%
Functions 91.40% 91.40% +0.00%
Branches 76.60% 76.70% +0.10%

Changed lines: 100.00% (8/8) · Uncovered code

Full report · Diff report

@alexey-milovidov

Copy link
Copy Markdown
Member

The remaining CI failure is 02180_group_by_lowcardinality ("result differs with reference"). This test is flaky on master itself: 19 failures with the same error pattern on master (PR=0) in the last 7 days, and 52–74 daily failures across many unrelated PRs (CIDB). It's unrelated to this PR, which only touches LIKE/ILIKE whitespace in ASTDropQuery and ASTShowColumnsQuery formatters. The test query uses group_by_overflow_mode='any' with max_rows_to_group_by=100 and no ORDER BY, which makes results inherently non-deterministic.

@groeneai, could you investigate the failure and provide a fix in a separate PR? If the fix is already in progress, please link it here.

@alexey-milovidov
alexey-milovidov merged commit 3c26482 into master May 19, 2026
164 of 167 checks passed
@alexey-milovidov
alexey-milovidov deleted the yarik/fix-ilike-trailing-space-parsing branch May 19, 2026 02:50
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label May 19, 2026
alexey-milovidov added a commit to vvo/ClickHouse that referenced this pull request May 19, 2026
* Fix for whitespace bug in LIKE parsing

* Fix whitespace bug in SHOW COLUMNS LIKE formatting

Address review: apply the same fix symmetrically to
`ASTShowColumnsQuery::formatQueryImpl`, which used `" LIKE"` (no trailing
space) before `quoteString(like)` and produced malformed output like
`LIKE'%x%'`. Extend the stateless `formatQuery` test to cover this path.

---------

Co-authored-by: Alexey Milovidov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default 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.

Missing space between LIKE keyword and pattern in TRUNCATE TABLES formatting

4 participants