Skip to content

fix(eap): Apply virtual columns to coalesced reads of their name - #8739

Merged
MeredithAnya merged 1 commit into
masterfrom
fix/virtual-column-coalesced-aliases
Nov 24, 2026
Merged

MeredithAnya merged 1 commit into
masterfrom
fix/virtual-column-coalesced-aliases

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Re-lands the sentry-conventions 0.35.0 bump (#8737, reverted in f8209206b) together with the fix for the regression it caused.

What broke

0.35.0 adds sentry.device.class as an alias of device.class (getsentry/sentry-conventions#804), so snuba now reads device.class as a coalesced value:

multiIf(has(mapKeys(attributes_string), 'device.class'), attributes_string['device.class'],
        attributes_string['sentry.device.class'])

Sentry sends device.class as a virtual column mapped from sentry.device.class. _apply_virtual_columns transforms expressions bottom-up and only rewrites reads keyed by to_column_name. So the value map landed inside one branch of the multiIf, and the fallback branch returned the raw sentry.device.class value, or NULL when neither key is set. Spans without a device class stopped resolving to Unknown in sentry's spans queries, which broke sentry's backend tests and blocked backend deploys.

Fix

A virtual column replaces every read of its name. Before applying the value map, _apply_virtual_columns now collapses coalesced reads of to_column_name back to a single-key read. This covers the SELECT/group-by form (attributes_string[...]), the filter form (arrayElement), and the OR'd has(mapKeys(...)) existence guard. It matches the exact expressions built by coalesced_attribute_names, first_present_value, and key_existence_conditions. Coalescing of the backing from_column_name is unchanged.

Rollout note

Merging puts 0.35.0 back into the snuba:nightly image that sentry's backend CI uses, so the sentry test job here needs to be green before this merges.

via @ElioDiNino.

--

View Session [Sentry]

sentry-conventions 0.35.0 adds sentry.device.class as an alias of
device.class, so reads of device.class now coalesce over both keys.
_apply_virtual_columns rewrites only the operands keyed by
to_column_name, so the alias operand leaked raw stored values (or NULL
when neither key is set) past the value map. Sentry's device.class
virtual column then stopped mapping missing values to Unknown.

Collapse coalesced reads of a virtual column's name back to a single-key
read before applying the mapping, and re-land the 0.35.0 bump reverted
in f820920.

Co-Authored-By: Elio Di Nino <[email protected]>
@ElioDiNino
ElioDiNino marked this pull request as ready for review November 23, 2026 23:32
@ElioDiNino
ElioDiNino requested review from a team as code owners November 23, 2026 23:32
@sentry-junior
sentry-junior Bot requested a review from ElioDiNino November 23, 2026 23:32
@MeredithAnya
MeredithAnya merged commit b5b538f into master Nov 24, 2026
74 checks passed
@MeredithAnya
MeredithAnya deleted the fix/virtual-column-coalesced-aliases branch November 24, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants