Skip to content

fix(clickhouse): Fix ARRAY JOIN alias broken by ClickHouse v26 new analyzer#8547

Merged
yurishkuro merged 1 commit into
mainfrom
copilot/investigate-spm-test-failure
May 11, 2026
Merged

fix(clickhouse): Fix ARRAY JOIN alias broken by ClickHouse v26 new analyzer#8547
yurishkuro merged 1 commit into
mainfrom
copilot/investigate-spm-test-failure

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 10, 2026

Root cause

The SPM ClickHouse e2e test (PR #8536) fails because ClickHouse v26's new analyzer changed how ARRAY JOIN nested_col AS alias resolves the alias type for nested-in-nested columns.

From the docker logs:

Error: failed to start extensions: ... failed to create event attribute metadata materialized view:
code: 44, message: There is no subcolumn bool_attributes.key in type Tuple(name String)

In ClickHouse v26, after ARRAY JOIN events AS e, the alias e gets type Tuple(name String) instead of the full nested type — so accessing e.bool_attributes.key (a sub-nested column) fails.

Fix

Remove the AS e / AS l aliases from the ARRAY JOIN clauses and reference the nested sub-columns via their full paths (events.bool_attributes.key, links.bool_attributes.key, etc.) instead. This works in both ClickHouse v25 and v26.

Before (create_event_attribute_metadata_mv.sql):

ARRAY JOIN events AS e
ARRAY JOIN arrayConcat(
    arrayMap(k -> (k, 'bool'),   e.bool_attributes.key),
    ...

After:

ARRAY JOIN events
ARRAY JOIN arrayConcat(
    arrayMap(k -> (k, 'bool'),   events.bool_attributes.key),
    ...

Same change in create_link_attribute_metadata_mv.sql (links AS llinks).

…alyzer

In ClickHouse v26, `ARRAY JOIN events AS e` followed by `e.bool_attributes.key`
fails with: code: 44, message: There is no subcolumn bool_attributes.key in type
Tuple(name String)

The new analyzer resolves the alias `e` to only `Tuple(name String)` instead of
the full nested type. Fix by removing the alias and using the full column path
(`events.*` / `links.*`) directly, which works in both v25 and v26.

Agent-Logs-Url: https://github.com/jaegertracing/jaeger/sessions/42ffacdc-96db-477d-ba0c-1b83420103db

Co-authored-by: yurishkuro <[email protected]>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes ClickHouse v26 compatibility for the v2 ClickHouse schema materialized views that extract event/link attribute keys. It avoids ARRAY JOIN <nested> AS <alias> because ClickHouse v26’s new analyzer can infer an incomplete alias type for nested-in-nested columns, causing subcolumn lookups (e.g., bool_attributes.key) to fail.

Changes:

  • Remove AS e / AS l aliases from ARRAY JOIN on events and links.
  • Update all nested attribute key references to use full paths like events.bool_attributes.key and links.complex_attributes.key.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/storage/v2/clickhouse/sql/create_link_attribute_metadata_mv.sql Drops links AS l alias and rewrites references to links.* subcolumns for ClickHouse v26 analyzer compatibility.
internal/storage/v2/clickhouse/sql/create_event_attribute_metadata_mv.sql Drops events AS e alias and rewrites references to events.* subcolumns for ClickHouse v26 analyzer compatibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.54%. Comparing base (d1eba12) to head (f67c4f8).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8547      +/-   ##
==========================================
+ Coverage   96.53%   96.54%   +0.01%     
==========================================
  Files         329      329              
  Lines       17342    17342              
==========================================
+ Hits        16741    16743       +2     
+ Misses        452      451       -1     
+ Partials      149      148       -1     
Flag Coverage Δ
badger_direct 8.97% <ø> (ø)
badger_e2e 1.04% <ø> (ø)
cassandra-4.x-direct-manual 14.59% <ø> (ø)
cassandra-4.x-e2e-auto 1.03% <ø> (ø)
cassandra-4.x-e2e-manual 1.03% <ø> (ø)
cassandra-5.x-direct-manual 14.59% <ø> (ø)
cassandra-5.x-e2e-auto 1.03% <ø> (ø)
cassandra-5.x-e2e-manual 1.03% <ø> (ø)
clickhouse-direct 9.00% <ø> (ø)
clickhouse-e2e 1.16% <ø> (ø)
elasticsearch-6.x-direct 16.83% <ø> (ø)
elasticsearch-7.x-direct 16.86% <ø> (ø)
elasticsearch-8.x-direct 17.01% <ø> (ø)
elasticsearch-8.x-e2e 1.04% <ø> (ø)
elasticsearch-9.x-e2e 1.04% <ø> (ø)
grpc_direct 7.91% <ø> (ø)
grpc_e2e 1.04% <ø> (ø)
kafka-3.x-v2 1.04% <ø> (ø)
memory_v2 1.04% <ø> (ø)
opensearch-1.x-direct 16.91% <ø> (ø)
opensearch-2.x-direct 16.91% <ø> (ø)
opensearch-2.x-e2e 1.04% <ø> (ø)
opensearch-3.x-e2e 1.04% <ø> (ø)
query 1.04% <ø> (ø)
tailsampling-processor 0.53% <ø> (ø)
unittests 94.82% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yurishkuro yurishkuro merged commit 760e030 into main May 11, 2026
76 of 80 checks passed
@yurishkuro yurishkuro deleted the copilot/investigate-spm-test-failure branch May 11, 2026 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants