Support for trailing comma in WITH before SELECT by arujbansal · Pull Request #101093 · ClickHouse/ClickHouse · GitHub
Skip to content

Support for trailing comma in WITH before SELECT#101093

Merged
alexey-milovidov merged 15 commits into
ClickHouse:masterfrom
arujbansal:with-trailing-comma
Apr 12, 2026
Merged

Support for trailing comma in WITH before SELECT#101093
alexey-milovidov merged 15 commits into
ClickHouse:masterfrom
arujbansal:with-trailing-comma

Conversation

@arujbansal

@arujbansal arujbansal commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Allow a trailing comma in the WITH clause before SELECT queries, e.g. WITH 1 AS a, 2 AS b, SELECT a + b.

The implementation adds an allow_trailing_separator parameter to ParserList and its parseUtil helper, which when enabled keeps the parser position past the trailing comma instead of backtracking.

This resolves #90780.

Changelog category:

  • Improvement

Changelog entry:

You can now have a trailing comma in the WITH clause before a SELECT query.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.852

@arujbansal arujbansal marked this pull request as ready for review March 29, 2026 16:59
@arujbansal

Copy link
Copy Markdown
Contributor Author

@arujbansal arujbansal changed the title Allow trailing comma in WITH clause Support for trailing comma in WITH before SELECT Mar 29, 2026
Comment thread docs/en/sql-reference/statements/select/with.md

@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.

The implementation LGTM, thank you!

@alexey-milovidov alexey-milovidov self-assigned this Mar 29, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Mar 29, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [1310604]

Summary:


AI Review

Summary

This PR adds support for a trailing comma in WITH before SELECT (for both scalar expressions and CTE forms), wires it through ParserList via an explicit allow_trailing_separator flag, and adds parser tests plus documentation. I reviewed parser behavior, call-site impact, and tests; I did not find any high-confidence correctness, safety, concurrency, or performance issues that require changes.

Missing context
  • ⚠️ No CI results/log links were provided in the review request, so this review is based on code and tests in the diff.
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

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Mar 29, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member

This PR is approved.

@arujbansal

arujbansal commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

Sounds good.

I’m not sure where else to ask this, so I’ll ask here. After going through the contribution workflow and contributing my first feature, I’d like to continue contributing to ClickHouse. Do you have any recommendations for tasks that would take roughly a few weeks to a month? I’d be interested in either implementing a standalone feature or working on existing ClickHouse internals.

@arujbansal

arujbansal commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

What do I do about these unrelated failures? I also had unrelated failures earlier so I merged with master and re-ran tests. Is it still possible to merge or does it have to be clean?

@alexey-milovidov

Copy link
Copy Markdown
Member

We are in the process of enabling extra fuzzing:

#97568
#98138
#100439
#100490
#101274

That's why there are many unrelated failures.
But these failures are genuine, and we have to fix them.
We are enabling this new combination of fuzzer in steps.

So far, no additional actions are needed; just hold.

@alexey-milovidov

Copy link
Copy Markdown
Member

After going through the contribution workflow and contributing my first feature, I’d like to continue contributing to ClickHouse.

This is amazing! There are many tasks under the "warmup task" label. For example, this one:
#59617

The idea is to make the url table function and engine work with various protocols, including file:// and s3://. The function will dispatch itself to the corresponding implementations. There are tricky details that have to be handled carefully. For example, many parameters for the s3 table function will have to be exposed as settings. But the initial implementation will be very simple - just to look at the protocol and dispatch to other table functions accordingly.

@alexey-milovidov

Copy link
Copy Markdown
Member

Also to clarify, why this task is needed.

Look at how DatabaseFilesystem and DatabaseOverlay are used in clickhouse-local. It allows to use local files, e.g., SELECT * FROM 'data.csv' along with tables. We will implement DatabaseURL similar to DatabaseFilesystem but it will support both URLs and files. So you can write SELECT * FROM 'data.csv' (using url_base), SELECT * FROM 'https://example.com/data.csv', SELECT * FROM 's3://mybucket/data.csv', etc.

@arujbansal

Copy link
Copy Markdown
Contributor Author

Thanks! #59617 does look like a good next task. I will work on that.

@alexey-milovidov

Copy link
Copy Markdown
Member

The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix.

@alexey-milovidov

Copy link
Copy Markdown
Member

The flaky test failures in this PR (01605_drop_settings_profile_while_assigned, 01418_custom_settings, 02015_async_inserts_4) are caused by non-unique access entity names and will be resolved by #102131.

@clickhouse-gh

clickhouse-gh Bot commented Apr 12, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.00% 84.10% +0.10%
Functions 90.80% 90.90% +0.10%
Branches 76.50% 76.60% +0.10%

Changed lines: 97.78% (44/45) | lost baseline coverage: 4 line(s) · Uncovered code

Full report · Diff report

@arujbansal

Copy link
Copy Markdown
Contributor Author

@alexey-milovidov alexey-milovidov added this pull request to the merge queue Apr 12, 2026
Merged via the queue into ClickHouse:master with commit 196fd77 Apr 12, 2026
164 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 Apr 12, 2026
fm4v added a commit that referenced this pull request Apr 14, 2026
Split flaky check and targeted check into separate roles:

Flaky check — runs only new/modified tests from the PR with thread
fuzzer enabled. Tests run in parallel with themselves (shared queue)
to ensure new tests are parallel-safe under randomized thread ordering.

Targeted check — runs previously failed and coverage-relevant tests
with per-worker partitioning (--no-self-parallel) so the same test
never runs concurrently on multiple workers, avoiding conflicts on
shared resources (hardcoded users, roles, settings profiles, etc.).
Both use --test-runs 50.

Changes:
- Add --no-self-parallel flag to clickhouse-test: partitions tests
  by name hash so all copies go to the same worker
- Flaky check: only changed tests, thread fuzzer, shared queue
- Targeted check: relevant tests, no thread fuzzer, per-worker queues,
  50 runs, single clickhouse-test invocation
- Restore original thread fuzzer parameters (reverts reductions from
  06c945a and 9790435)
- Add amd_binary to flaky check, use AMD_LARGE for targeted debug
- Targeted check uses --flaky-check --no-self-parallel

PRs affected by tests running in parallel with themselves:
#102015 #101093 #99653 #101503 #101108 #101884 #100746
#101447 #100941 #101099 #100203 #96130

#102038
fm4v added a commit that referenced this pull request Apr 14, 2026
Split flaky check and targeted check into separate roles:

Flaky check — runs only new/modified tests from the PR with thread
fuzzer enabled. Tests can run in parallel with themselves (shared
queue) to ensure new tests are parallel-safe.

Targeted check — runs previously failed and coverage-relevant tests
with per-worker partitioning (--no-self-parallel) so the same test
never runs concurrently on multiple workers, avoiding conflicts on
shared resources (hardcoded users, roles, settings profiles, etc.).
Both use --test-runs 50.

Changes:
- Add --no-self-parallel flag to clickhouse-test: partitions tests
  by name hash so all copies go to the same worker
- Flaky check: only changed tests, thread fuzzer, shared queue
- Targeted check: relevant tests, no thread fuzzer, per-worker
  partitioning, 50 runs, single clickhouse-test invocation
- Restore original thread fuzzer parameters
- Change targeted check to arm_asan_ubsan on ARM_LARGE

PRs affected by tests running in parallel with themselves:
#102015 #101093 #99653 #101503 #101108 #101884 #100746
#101447 #100941 #101099 #100203 #96130
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-improvement Pull request with some product improvements 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.

Support for trailing comma in WITH before SELECT

3 participants