Skip to content

Fix logical error on DISTINCT-in-order over ARRAY JOIN with stale sort property - #110778

Merged
PedroTadim merged 10 commits into
ClickHouse:masterfrom
groeneai:fix-distinct-in-order-array-join-phantom-sort
Oct 9, 2026
Merged

PedroTadim merged 10 commits into
ClickHouse:masterfrom
groeneai:fix-distinct-in-order-array-join-phantom-sort

Conversation

@groeneai

@groeneai groeneai commented Jul 17, 2026 •

Copy link
Copy Markdown
Collaborator

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

Fix a logical error Equal values are not contiguous within the range assumed to be sorted (and potential wrong DISTINCT results) when optimize_distinct_in_order is enabled and an ORDER BY over an arrayJoin-derived column is followed by another ARRAY JOIN that reproduces a column of the same name.

Description

applyActionsToSortDescription() returned early whenever the expression it was pushing the sort description through contained an ARRAY JOIN, leaving the sort description unchanged. When such an expression re-applies an ARRAY JOIN that produces an output column named identically to the sorted input column, the output stream is no longer sorted by that column, yet the stale ... ASC sort property survived and propagated up to the DISTINCT step. That step then ran distinct-in-order (DistinctSortedStreamTransform) over genuinely unsorted data and aborted with the logical error (or, in a release build, could return wrong DISTINCT results).

Removing the blanket early-return lets the existing chain-tracing logic handle ARRAY JOIN correctly: the monotonic chain breaks at an ARRAY JOIN node, so array-join-derived sort columns are dropped, while genuinely order-preserving columns (array join only replicates rows in place) are kept.

The failing shape is produced, for example, by decorrelating a correlated scalar subquery whose body is SELECT DISTINCT ... ORDER BY <arrayJoin column> SETTINGS optimize_distinct_in_order = 1. This is the no-JOIN variant of the DistinctSortedStreamTransform invariant family; it is not covered by #109225.

Found by the AST/BuzzHouse fuzzers (STID 2508-348f). The regression test 04550_distinct_in_order_array_join_phantom_sort aborts without the fix and passes with it.

On 26.9.2.8 with default settings, WITH arrayJoin(['a', 'A']) AS s SELECT DISTINCT s FROM (SELECT number FROM numbers(2) ORDER BY s) returns eight rows instead of a, A, and LIMIT 1 BY s over the same subquery returns the same eight rows. Latest fuzzer occurrence (STID 2508-3e4f): https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=122303&sha=230bec1bc249488db9045c5f49e7bd424d9f266e&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%2C%20old_compatibility%29

Since 26.10 the default query_plan_lower_array_join_function = 1 moves the arrayJoin into an ARRAY JOIN step that bypasses this code, so master hides the bug by default. It still aborts there with query_plan_lower_array_join_function = 0 or compatibility = '26.9', and the test pins the setting to 0.


Workflow [PR]
Sync PR [sync-upstream/pr/110778]

Version info

  • Merged into: 26.10.1.1934-master (included in 26.10 and later)

…ption

applyActionsToSortDescription() returned early whenever the expression
contained an ARRAY JOIN, leaving the input sort description unchanged. When
that expression re-applies an ARRAY JOIN producing an output column named
identically to the sorted input, the stream is no longer sorted by that
column, but the stale sort property survived and reached the DISTINCT step,
which then ran distinct-in-order (DistinctSortedStreamTransform) over unsorted
data and hit 'Equal values are not contiguous within the range assumed to be
sorted'. Removing the blanket early-return lets the existing chain-tracing
logic drop array-join-derived sort columns (the monotonic chain breaks at
ARRAY JOIN) while preserving genuinely order-preserving columns.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Check Result
a Deterministic repro? Yes. SELECT DISTINCT s FROM (SELECT DISTINCT arrayJoin(['x','y','']) AS s WHERE isNotNull((SELECT DISTINCT s FROM (SELECT toFixedString(NULL,16) ORDER BY s ASC NULLS LAST) LIMIT 1 SETTINGS optimize_distinct_in_order=1))) ORDER BY s SETTINGS optimize_distinct_in_order=1 aborts every run on debug and asan builds.
b Root cause explained? applyActionsToSortDescription() bailed out (if (dag.hasArrayJoin()) return;) leaving the sort description unchanged. The expression above the Sorting step re-applies an ARRAY JOIN producing an output column named identically to the sorted input, so the stream is no longer sorted by it, yet the stale arrayJoin(...) ASC property survived and reached the DISTINCT step, which ran DistinctSortedStreamTransform over unsorted data.
c Fix matches root cause? Yes. Removes the blanket early-return so the existing chain-tracing logic handles ARRAY JOIN: the monotonic chain breaks at an ARRAY_JOIN node, dropping array-join-derived sort columns while keeping genuinely order-preserving columns.
d Test intent preserved / new test added? New regression test 04550_distinct_in_order_array_join_phantom_sort. No existing test weakened.
e Demonstrated in both directions? Yes. Test aborts (LOGICAL_ERROR) without the fix, passes with it. Verified on a fresh-master build.
f Fix is general, not a narrow patch? The fix is at the shared sort-property-propagation helper, so it covers every plan shape where an ARRAY JOIN expression reproduces a sorted column name (not just the correlated-subquery repro). The general chain-tracing already existed; the guard was masking it.
g Generalizes across inputs/wrappers? The mechanism is name-based on the DAG, independent of column type. Verified with String and FixedString(Nullable); array join drops the derived sort key regardless of element type.
h Backward compatible? Yes. No setting default, no on-disk/wire format change. Only removes an over-broad guard that produced a wrong (unsorted) sort property. Behavior only changes for the previously-broken case.
i Invariants and contracts preserved? Yes. Upholds the DistinctSortedStreamTransform contract that the input is actually sorted by distinct_sort_desc. Array join replicates rows in place, so non-exploded prefix sort columns remain valid and are still preserved by the chain logic.

Ran the local distinct_in_order / read_in_order / array_join*order stateless suite (61 tests) on both pristine and fixed builds: identical pass/fail set, zero regressions introduced by the fix.

Session id: cron:clickhouse-worker-slot-0:20260717-040200

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @KochetovNicolai @vdimir - could you review this? It removes the blanket if (dag.hasArrayJoin()) return; early-return in applyActionsToSortDescription, which kept a stale sort property when an expression re-applies an ARRAY JOIN producing an identically-named column, causing DISTINCT-in-order to run over unsorted data (LOGICAL_ERROR / wrong results). The existing chain-tracing already drops array-join-derived sort columns correctly.

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Jul 17, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e192632]

Summary: ✅


AI Review

Summary

This PR removes the blanket hasArrayJoin() bailout from applyActionsToSortDescription, so sort-property propagation can keep unaffected keys across ARRAY JOIN expressions while still dropping array-join-derived keys via the existing chain tracing. In the current code and diff, I do not see a remaining correctness, safety, or performance issue, and the added stateless regression covers both the original stale-sort repro and the preserved-prefix case that previously regressed during discussion.

Final Verdict
  • Status: ✅ Approve

LLVM Coverage Report

Measured on commit 9b586a0.

Metric Baseline Current Δ
Lines 88.30% 88.30% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 79.80% 79.70% -0.10%

Changed lines: Changed C/C++ lines covered: 3/3 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jul 17, 2026
groeneai and others added 2 commits July 17, 2026 12:46
…aborting the scan

The output-scan loop broke out of the whole dag.getOutputs() walk on the first
output that is not a pure input/alias/monotonic chain. That was harmless behind
the old hasArrayJoin() early-return guard, but once the guard was removed an
ARRAY JOIN result appearing before a preserved key wiped the entire valid sort
prefix instead of just dropping the exploded key. ActionsDAG::project preserves
projection order and updateHeader materializes outputs in that order, so a shape
like SELECT arrayJoin(arr) AS x, a ... ORDER BY a LIMIT 1 BY a visits x first,
broke there, and left a.output == nullptr; the final loop then shrank the
description to empty even though a is still sorted across the ARRAY JOIN. This
silently disabled LIMIT BY / DISTINCT / finish-sorting in-order optimizations
for unaffected prefix keys.

Each rejected output is a per-output condition, so replace the five break
statements with continue: the scan keeps visiting later outputs and every
output is still individually validated before acceptance, so the sort prefix
can only be preserved correctly, never over-extended.

Extends the regression to assert that an ARRAY JOIN output preceding a
preserved key still yields DistinctSortedStreamTransform / LimitBySortedStreamTransform.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The first query relies on correlated scalar subquery decorrelation, a
new-analyzer-only feature. On the old analyzer it fails with Code 47
UNKNOWN_IDENTIFIER (Missing columns: 's') before the ARRAY-JOIN phantom-sort
shape can even form, so the whole test failed on the old-analyzer CI job.

Pin enable_analyzer=1 on that query only. The two EXPLAIN PIPELINE assertions
(DistinctSortedStreamTransform / LimitBySortedStreamTransform) are analyzer
-independent and keep running on both analyzers, so the bot-CR fix
(skip-not-break in applyActionsToSortDescription) stays covered under both.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@alexey-milovidov alexey-milovidov mentioned this pull request Jul 17, 2026
1 task done
The style check forbids the phrase "new analyzer" since the analyzer
is default and no longer new. Reword the enable_analyzer=1 call-site
comment to say "the analyzer". Comment-only, no behavior change.
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — f9b714f

CI finished on this head (the Style comment-reword fix). Every failure has an owner; none are caused by this PR's diff.

Check / test Reason Owner / fixing PR
Integration tests (amd_asan_ubsan db-disk old-analyzer 3/6; amd_tsan 3/6; amd_msan 7/8) / test_replicated_database::test_replicated_table_structure_alter flaky (889 hits / 433 PRs / 87 master in 30d) #110030 (external, open) "Fix flaky test_replicated_table_structure_alter"
Sync - CH Inc sync (private, not actionable)

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110778&sha=f9b714f5dfeff7c3fa5af7c061f40a367fc8a6d1&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%203%2F6%29

Session id: cron:our-pr-ci-monitor:20260718-020000

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — f9b714f

CI fully finished on this head (Finish Workflow SUCCESS). All failures owned; none PR-caused.

Check / test Reason Owner / fixing PR
Integration (amd_msan 7/8) + (amd_asan_ubsan db disk old analyzer 3/6) + (amd_tsan 3/6) / test_replicated_database::test_replicated_table_structure_alter flaky (known, tracked in #110036; unrelated to the DISTINCT-in-order arrayJoin fix) #110030 (ours, open)

None PR-caused (all three are the same replicated-DDL flaky test, unrelated to the arrayJoin phantom-sort fix this PR makes).

Session id: cron:our-pr-ci-monitor:20260718-033000

@clickhouse-gh

clickhouse-gh Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.30% 86.30% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 78.50% 78.50% +0.00%

Changed lines: Changed C/C++ lines covered: 24/24 (100.00%) · Uncovered code

Full report · Diff report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 9f4ee37

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Integration tests (amd_tsan, 1/6) / test_postgresql_replica_database_engine (7 tests + session timeout) TSan data race in the StorageMaterializedPostgreSQL destructor against ServerAsynchronousMetrics::updateImpl kills the server and cascades the shard a fix task is created (investigating at full effort — fixing-PR link to follow here)
Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) / 01666_merge_tree_max_query_limit deterministic under parallel replicas (3/3 reruns failed) #112385 (ours, open)

Session id: cron:our-pr-ci-monitor:20260729-043000

@groeneai

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the test_postgresql_replica_database_engine Connection-refused cascade dispositioned to a fix task on this PR's CI finish ledger: #112381 (merged), with the re-land #112382.

Root cause: #109339 added a materialized_tables traversal to DatabaseMaterializedPostgreSQL::getTablesIterator. The asynchronous-metrics thread reaches that iterator (ServerAsynchronousMetrics.cpp:447, and this database reports isExternal() == false so it is not skipped) while stopReplication clears the same map holding only handler_mutex, never tables_mutex. That is a heap-use-after-free on the stored wrappers, it killed the server, and every remaining test in the module then failed inside the autouse setup_teardown fixture with Code: 210 Connection refused. One server death per job, not N independent flaky tests.

Timeline: #109339 merged 2026-07-28 13:16 UTC, the master cascade began the same evening, #112381 reverted it 2026-07-29 01:39 UTC. Every failing build contained the introducing commit and lacked the revert. True-master runs since the revert are clean: 0 failures against 6804 passing rows across 23 distinct commits. #112382 re-lands the feature with tables_mutex taken on all materialized_tables touch points, including the swap-and-destroy-outside-the-lock form in stopReplication.

No action is needed on this PR: its diff never touched PostgreSQL replication and did not cause this line.

The CI run on 4d641d9 was dropped in full: Config Workflow read-timed-out
against play.clickhouse.com on all five CIDB retries, blew its 600s budget,
was SIGTERMed, and praktika cascaded every dependee job to DROPPED. 171 of
175 checks are SKIPPED, so no build or test job ever ran on this head. Four
other PRs were hit in the same four-minute window on 2026-08-01.

Empty commit: a fresh head SHA is the only re-trigger available without
write access, and CI tests the merge-with-master ref anyway, so no master
merge is needed.

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 9, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit e192632a021a4bec8e8cb22976ce8c4fbaed7cb8 was not compared: the CI logs cluster did not answer (every POST attempt failed with an exception).

See the job log for details.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 5ee48f7

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stress test (arm_asan_ubsan, s3) / Bad cast from DB::ColumnString to DB::ColumnNullable (STID 3520-4525) chronic trunk abort in SerializationNullable::enumerateStreams reached through SerializationArray::enumerateStreams; unrelated to sort-description handling #113925 (mine, open) - absent from the build tested here
Stress test (arm_release) / Reading from materialized CTE 'ct' before its materialization completed - DelayedPortsProcessor gate is missing in the query plan (STID 2467-3539) chronic trunk planner defect; aborts from FutureSetFromSubquery::buildOrderedSetInplace under optimizePrewhere inside ReadFromMerge::createChildrenPlans #102308 (external, open)

Config Workflow SUCCESS, Finish Workflow SUCCESS; 179 check-runs, 0 incomplete, 158 success.

Both aborts are in serialization and planner code this PR does not touch, and both are wide carriers
rather than PR-specific: over 30 days STID 3520-4525 has hits on a dozen unrelated pull requests plus
6 pull_request_number = 0 master rows, and STID 2467-3539 belongs to the 2467-2c2d family whose
recent breadth is 66 rows across 53 pull requests with 6 master rows.

Session id: cron:our-pr-ci-monitor:20260810-023000

@qoega

qoega commented Sep 2, 2026

Copy link
Copy Markdown
Member

Adding a new-trigger data point for this stale-sort-property family — reproducible during fuzzing on dafcf6b09a2 (v26.9.1.1), not deterministically standalone.

Debug abort (chassert — silent wrong DISTINCT on release, cf. #109216):

Logical error: 'Equal values are not contiguous within the range assumed to be sorted'
  at src/Columns/findEqualRangeEndAssumeSorted.h:89

Stack (server):

DistinctSortedStreamTransform::transform          (DistinctSortedStreamTransform.cpp:184)
  → getEqualRangeEndAssumeSorted                  (SortCursor.h:813)
      → IColumn::getEqualRangeEndAssumeSorted     (IColumn.cpp:265)
          → chassert

Fuzzed query (oracle-internal sub-query):

SELECT DISTINCT a, b
FROM merge('^')
WHERE b IS NOT NULL
WINDOW w_fuzz_11533 AS ()
ORDER BY a DESC NULLS LAST;

New wrinkle vs. #109216 (partial_merge JOIN) and this PR's ARRAY JOIN carrier: merge() over a heterogeneous set of tables. The merge('^') glob resolved to 22 constituents with a, b:

  • _s1 (MergeTree ORDER BY a), _s1__fuzz_57 (AggregatingMergeTree ORDER BY a),
  • ~19 fuzzer-created Merge('default', '^_s1__fuzz_57$') wrappers,
  • _r_lc and _r_null (ORDER BY id — not sorted by a; a/b types differ: LowCardinality(String), Nullable(UInt8)),
  • 4 Dictionary-engine tables read concurrently at fuzz time (_r_dict + fuzzer _r_dict__fuzz_*, constants under Merge).

Merge unifies the mixed-type a column into Variant(LowCardinality(String), UInt32), which is what allow_suspicious_types_in_order_by = 1 (set by the fuzzer's prelude) lets through into optimize_distinct_in_order. So the planner sees a Variant-typed key from a Merge that reads both ORDER BY a and ORDER BY id constituents — the union is not a-sorted, but a sort property still propagated into DistinctSorted without a preceding full sort.

Batch settings prelude on that fuzzer instance:

SET max_block_size = 8192;
SET join_algorithm = 'parallel_hash';
SET group_by_two_level_threshold = 1;
SET compile_expressions = 1;
SET min_count_to_compile_expression = 3;
SET use_uncompressed_cache = 0;

(plus the analyzer defaults on that build).

Not standalone reproducible after: exact-query replay against the preserved data dir → early exit on Code 44 (Variant in ORDER BY) because merge('^') picks a different first-matching table order across restarts; six constituent bisections; Variant-key standalones (release + debug); WINDOW/nested-Merge/max_threads = 1/read-in-order variants; Dictionary constituents; and a 240-second concurrency stress reproducer (1,097 create/insert/drop churn cycles + 156 dictionary reloads interleaved with 2,057 DISTINCT-over-merge queries on the debug build, 0 aborts). Consistent with a plan-time vs execution-time race in the oracle-internal path — same "stale sort property" shape this PR fixes, but the trigger side is merge() picking up its sort property while its constituents churn.

If a follow-up regression arm here wants to lock this trigger down, the shape is: SELECT DISTINCT (+ optimize_distinct_in_order) over a merge() whose constituents span differing per-column sort-key types (yielding a Variant unified key) and a mix of ORDER BY key = a vs ORDER BY key ≠ a engines. A separate hardening candidate independent of this PR: merge()'s sort-property computation over concurrently-changing constituents.

cc @groeneai

@groeneai

groeneai commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

Useful breakdown, thanks.

This PR cannot reach that trigger. Its entire diff is src/Processors/QueryPlan/Optimizations/actionsDAGUtils.cpp (+8/-8) plus test 04550, nothing under src/Storages/. It only changes what happens to the other sort keys when one DAG output fails to validate as an order-preserving chain; it never makes an unvalidatable output validate. So it can neither cause nor cure a merge() sort property.

The merge() side already carries both halves of what you propose, as of e0b752b337e3 (#113242, merged 2026-08-30). StorageMerge::getQueryProcessingStage refuses a delegated stage when a child's type does not convert order-preservingly to the declared type (conversionPreservesOrder, which has no Variant branch, so a Variant target falls through to a refusal on every path). And ReadFromMerge::createChildrenPlans re-runs the same predicate against the later, frozen child set, throwing INCOMPATIBLE_COLUMNS ("the query processing stage was chosen before this type was visible, most likely because the table was altered, or started matching the regexp, while the query was being planned") instead of returning rows. That second check is the "merge()'s sort-property computation over concurrently-changing constituents" window.

What I cannot settle from here is whether your run predates it. dafcf6b09a2 does not resolve in this repo (/commits/dafcf6b09a2 returns 422, search/commits?q=hash: returns 0 results), and v26.9.1.1 only means "master after 2026-08-24". @qoega, whether that build contains e0b752b337e3 is the one data point that decides whether this is already closed or a genuinely new gap.

Measured on master today (debug clickhouse local, 88dd1634, 929 commits ahead of e0b752b337e3): the constructible half of your shape is clean. A column-list-less merge() over your constituent mix (MergeTree ORDER BY a, AggregatingMergeTree ORDER BY a, two nested Merge wrappers, _r_lc and _r_null on ORDER BY id with divergent a/b types, a Dictionary table) derives Variant(LowCardinality(String), UInt32, UInt8), and your query text including the WINDOW w_fuzz_11533 AS () clause returns 300 rows / 100 distinct a / 3 distinct b, identical to the same query under optimize_distinct_in_order = 0, optimize_read_in_order = 0. No sort description reaches the children.

Isolating the cast, with all children ORDER BY a so nothing else differs:

  • UInt32 + UInt64 unified to UInt64: EXPLAIN PLAN sorting = 1 shows Sorting: materialize(CAST(a AS UInt64)) ASC and Read type: InOrder on both children.
  • UInt32 + LowCardinality(String) unified to Variant(LowCardinality(String), UInt32): no child sort description, no Read type: InOrder, values equal to ground truth.

So the probe does fire when the conversion is safe, and does not for your derived type.

On a regression arm here: no. The constructible part is green on this branch and on master, with and without this diff, so an assertion over it cannot fail; that is a vacuous oracle rather than a lock on your trigger, and it is why an arm proposed on this PR on 2026-08-09 was refused as well (#110778 (comment)). What is not constructible is the churn itself, which your 240 s / 2,057-query stress did not hit either. If a static Variant-target arm is wanted, it belongs beside its own gate in 04721_merge_child_type_conversion_order, and it would pass today.

@qoega

qoega commented Sep 2, 2026

Copy link
Copy Markdown
Member

Answered — the fleet is pre-#113242. git merge-base --is-ancestor e0b752b337e3 dafcf6b09a2 returns NO; dafcf6b09a2 is a 2026-08-31 21:50 tip of our internal oracle-suite branch that hadn't merged master yet, and git show dafcf6b09a2:src/Storages/StorageMerge.cpp | grep -c conversionPreservesOrder returns 0. So neither of the two guards you cite (StorageMerge::getQueryProcessingStage's conversion-order refusal, ReadFromMerge::createChildrenPlans's frozen-set re-check) was in the binary this fired on.

Combined with your measurement on today's master (constructible half returns 300 rows / 100 distinct a / 3 distinct b, identical under optimize_distinct_in_order = 0, no child sort description), that lands the diagnosis: the trigger we hit is exactly what #113242 already covers, and the assertion arm here would be vacuous over the constructible part. Withdrawing the regression-arm suggestion; noting the earlier r3745557434 discussion for consistency.

The fleet is rebuilding from oracle-suite onto current master right now (was 1,596 commits behind — cf. our own tick #19). Once the rebuild lands #113242 in the fleet binary, this signature should drop out of the campaign; if it recurs post-rebuild I'll come back with a fresh reduction rather than reopening this one.

Thanks for the trace through conversionPreservesOrder and the r3745557434 pointer — that's the useful part for us either way.

cc @groeneai

@clickhouse-gh clickhouse-gh Bot added the comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... label Sep 4, 2026
groeneai and others added 3 commits October 7, 2026 12:26
…er-array-join-phantom-sort

# Conflicts:
#	src/Processors/QueryPlan/Optimizations/actionsDAGUtils.cpp
Since query_plan_lower_array_join_function became the default, the
arrayJoin of these queries is moved into an ARRAY JOIN step and never
reaches applyActionsToSortDescription, so the test no longer covered the
defect: the first query passed on master, and the two EXPLAIN arms
returned 0 on the fixed binary (the ARRAY JOIN step drops the sort
property). The defect itself is still reachable with the setting off,
including via compatibility = '26.9'.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous run on e192632 was abandoned by the GitHub Actions
runner-acquisition outage of 2026-10-07 15:15-15:35Z (63 jobs DROPPED as
did_not_finish: abandoned) and was not re-run. No content change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@PedroTadim PedroTadim self-assigned this Oct 9, 2026
@PedroTadim
PedroTadim added this pull request to the merge queue Oct 9, 2026
Merged via the queue into ClickHouse:master with commit ea30d77 Oct 9, 2026
152 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 9, 2026
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 comp-query-optimizer Query plan optimization: physical plan steps, plan-level rewrites and optimizations (QueryPlan pa... groeneai-origin-unknown PR origin: unclassified (legacy task) 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.

5 participants