Skip to content

Add regression test for Merge over Distributed virtual columns with JOIN - #107418

Merged
yakov-olkhovskiy merged 1 commit into
masterfrom
cursor/regression-test-merge-distributed-virtual-columns-84139-dc36
Jun 14, 2026
Merged

yakov-olkhovskiy merged 1 commit into
masterfrom
cursor/regression-test-merge-distributed-virtual-columns-84139-dc36

Conversation

@yakov-olkhovskiy

@yakov-olkhovskiy yakov-olkhovskiy commented Jun 13, 2026 •

Copy link
Copy Markdown
Member

Adds a regression test for the analyzer issue where selecting _table (and/or _database) from a Merge over a Distributed table together with a LEFT JOIN returned default (empty) values instead of the real ones, and could also scramble other columns (e.g. id was returned as 0).

The bug is no longer reproducible on master: it was fixed by #102304 ("Native Common Virtuals for Remaining Storage") and #102471 ("Storage merge always proxy virtuals to underlying storages"), which made Merge always proxy virtual columns to the underlying storages, so _database and _table are produced natively by the nested Distributed query and no longer require ad-hoc rewrites in StorageMerge.

This test is the regression-only follow-up to #85917, with the expected output updated to match the post-refactor behavior (correct _database and _table values).

Closes: #84139
Related: #102304
Related: #102471
Related: #85917

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

Add a regression test for Merge over Distributed virtual columns (_table, _database) with LEFT JOIN under the analyzer.

Open in Web Open in Cursor 

Version info

  • Merged into: 26.6.1.792

Verifies that selecting `_table` and `_database` from a `Merge` over a
`Distributed` table together with a `LEFT JOIN` returns the real virtual
column values when the analyzer is enabled.

Issue: #84139
Fixed by:
  - #102304
  - #102471

Co-authored-by: Yakov Olkhovskiy <[email protected]>
@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 sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@clickhouse-gh

clickhouse-gh Bot commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ddc95d5]

Summary: ✅


AI Review

Summary

This PR adds a focused stateless regression test for Merge over Distributed virtual columns with LEFT JOIN under the analyzer. The test checks both unqualified and aliased access to _database / _table, and verifies that id is preserved for matched and unmatched rows. I found no code-review findings in the added test.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 13, 2026
@yakov-olkhovskiy
yakov-olkhovskiy marked this pull request as ready for review June 13, 2026 21:17
@clickhouse-gh

clickhouse-gh Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.70% 84.70% +0.00%
Functions 92.30% 92.40% +0.10%
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: 314 line(s), 56 function(s) across 112 file(s) · Details

Top files
  • src/Functions/FunctionShowCertificate.cpp: 38 line(s), 4 function(s)
  • src/Disks/IO/CachedOnDiskWriteBufferFromFile.cpp: 15 line(s)
  • src/AggregateFunctions/TimeSeries/AggregateFunctionTimeseriesChanges.h: 14 line(s), 32 function(s)
  • src/Storages/Statistics/ConditionSelectivityEstimator.cpp: 11 line(s), 2 function(s)
  • src/AggregateFunctions/TimeSeries/AggregateFunctionTimeSeriesGroupArray.h: 10 line(s), 8 function(s)

Full report

@yakov-olkhovskiy
yakov-olkhovskiy added this pull request to the merge queue Jun 14, 2026
Merged via the queue into master with commit f5af4a5 Jun 14, 2026
166 checks passed
@yakov-olkhovskiy
yakov-olkhovskiy deleted the cursor/regression-test-merge-distributed-virtual-columns-84139-dc36 branch June 14, 2026 22:41
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 14, 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.

Analyzer. Empty result when using _table column in merge + left join distributed table.

4 participants