Repository navigation
Fix flaky test 03668_shard_join_in_reverse_order - #101654
alexey-milovidov merged 2 commits into
Conversation
|
Workflow [PR], commit [2a43ece] Summary: ❌
AI ReviewSummaryThis PR fixes flaky test Missing context
ClickHouse Rules
Final Verdict
|
|
|
||
| INSERT INTO TABLE t0 (c0) SELECT number FROM numbers(10); | ||
|
|
||
| SELECT c0 FROM t0 JOIN t0 tx USING (c0) ORDER BY c0 SETTINGS query_plan_join_shard_by_pk_ranges = 1, max_threads = 2, query_plan_read_in_order_through_join = 1; |
There was a problem hiding this comment.
Here query_plan_read_in_order_through_join was pinned to 1 in #91749 after enabling randomization for this setting. With this fix we don't need that pinning anymore.
|
|
||
| DROP TABLE IF EXISTS t0; | ||
|
|
||
| CREATE TABLE t0 (c0 Int) ENGINE = MergeTree() ORDER BY (c0 DESC) SETTINGS index_granularity = 1, allow_experimental_reverse_key = 1; |
There was a problem hiding this comment.
Here CREATE TABLE ... ORDER BY (c0 DESC) produces table sorted in descending order, however SELECT ORDER BY c0 requires data in ascending order. So
current_direction to 1 * (-1) = -1 and thus in ReadFromMergeTree::readByLayers() we should read data in descending order to match the SELECT query.
There was a problem hiding this comment.
Pull request overview
Fixes flakiness in stateless test 03668_shard_join_in_reverse_order by ensuring the read-in-order path respects reverse read direction and by making the test exercise both the generic and forced “read-in-order through JOIN sharding” execution paths deterministically.
Changes:
- Update
ReadFromMergeTree::readByLayers()to useReadType::InReverseOrderwheninput_order_info->directionindicates reverse reading. - Adjust the stateless test to run the JOIN query twice (baseline + forced settings) with a clear separator in output.
- Update the expected
.referenceoutput to match the new test structure.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/queries/0_stateless/03668_shard_join_in_reverse_order.sql |
Adds a baseline query and a second query with pinned settings to reliably trigger the read-in-order-through-join path. |
tests/queries/0_stateless/03668_shard_join_in_reverse_order.reference |
Updates expected output to include results from both queries and the separator line. |
src/Processors/QueryPlan/ReadFromMergeTree.cpp |
Fixes reverse-direction handling in the layered read-in-order path by selecting the correct ReadType. |
|
I think this is a duplicate of #101153 |
LLVM Coverage Report
Changed lines: 92.86% (13/14) · Uncovered code |
…68_shard_join_in_reverse_order Fix flaky test 03668_shard_join_in_reverse_order
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix flaky test 03668_shard_join_in_reverse_order
Closes #100870
Version info
26.4.1.567