ILIKE multi column selection#104569
Conversation
Add `* ILIKE` examples to the `Dynamic column selection` section and clarify that the pattern uses `LIKE` semantics rather than `re2` regular expression semantics.
Expand `table.COLUMNS` regexp matchers in the old analyzer paths so `table.* ILIKE` works when `enable_analyzer` is disabled. This fixes the reproducible failure in `04218_asterisk_ilike` for `SELECT t.* ILIKE %id ...`.
Add a regression query with a qualified `* ILIKE` matcher over multiple joins and `enable_analyzer = 0` so the old analyzer join-to-subquery rewrite path is exercised.
|
Note: this PR also fixes a related old-analyzer inconsistency discovered while implementing
To make For example, before this PR, a query like this worked with the new analyzer but failed with SELECT a.COLUMNS('(?i)id$')
FROM (SELECT number AS UserID FROM numbers(1)) AS a
LEFT JOIN (SELECT number AS id FROM numbers(1)) AS b ON b.id = a.UserID
LEFT JOIN (SELECT number AS id FROM numbers(1)) AS c ON c.id = a.UserID
SETTINGS enable_analyzer = 0; |
|
Hi @alexey-milovidov, this PR is ready for review, could you please help? Thanks. |
|
This looks strange to me. First I thought it will apply the function to every column. For example: But it does a different thing. How would we resolve this ambiguity later? |
I checked support in other SQL dialects:
I also briefly checked Pinot/Druid/DataFusion/Trino and didn't find such capability. So this is not Snowflake-specific (DuckDB has it as well) but it is not widespread either. @alexey-milovidov please advise if we should proceed, and feel free to reject this PR if we consider this syntax too niche or not worth extending the parser for. |
|
I'm ok with that, but let's also add LIKE support. |
Per review feedback, support `* LIKE '<pattern>'` (and qualified `table.* LIKE '<pattern>'`) in addition to the case-insensitive `* ILIKE '<pattern>'`. The shared parser helper now accepts both `LIKE` and `ILIKE` keywords; `LIKE` matches column names case-sensitively while `ILIKE` remains case-insensitive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Added case-sensitive
Verified locally on a freshly built binary: the test matches its reference, both The only prior CI failure was |
|
@groeneai, investigate the failure: Upgrade check (amd_release) — "Error message in clickhouse-server.log" and provide a fix in a separate PR if needed. If the fix is already in progress, link it here. The flagged error messages are all I have merged the latest |
|
@alexey-milovidov, the fix is already merged: #106516 (merged 2026-06-06, master commit The current What the fix does: adds a regex allowlist line to Recurrence on this PR's fresh build with the fix in place would be a new flake, not the same one. CIDB shows this signature affected 53 unrelated PRs in 30d before the fix landed. session: cron:clickhouse-ci-task-worker:20260607-171600 |
Expand nested qualified `COLUMNS` regexp matchers before old analyzer join-to-subquery rewrite collects identifiers, and add coverage for nested `a.* ILIKE` with both analyzers. Follow-up for ClickHouse#104569 (comment)
Add regression coverage for nested `a.* ILIKE` used as an argument to binary `plus`, including the multi-column expansion error path.
LLVM Coverage ReportChanged lines: Changed C/C++ lines covered by tests: 156/175 (89.14%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 3 line(s) · Uncovered code |

Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
* LIKE '<pattern>'and* ILIKE '<pattern>', including qualified forms such astable.* LIKE '<pattern>'andtable.* ILIKE '<pattern>'.LIKEmatches column names case-sensitively,ILIKEcase-insensitively.Documentation entry for user-facing changes
This PR also adds old-analyzer (
enable_analyzer = 0) support for qualifiedCOLUMNSregexp matchers, fixing a pre-existing inconsistency wherea.COLUMNS('...')worked with the new analyzer but failed with the old analyzer through the multiple-join rewrite path.Closes: #53163
Version info
26.6.1.527