fix(insights): coerce aggregation_target type in multi-source funnels#58711
fix(insights): coerce aggregation_target type in multi-source funnels#58711sampennington wants to merge 1 commit into
Conversation
A funnel that combines series from multiple source tables (e.g. a regular events step plus a data-warehouse step) builds one subquery per source and combines them with UNION ALL. Each source resolves aggregation_target to its own type — person_id is a UUID, a warehouse column is often a string — and UNION ALL has no common type for UUID and String, failing the whole query with NO_COMMON_TYPE. Coerce every branch's aggregation_target to a string when more than one source query is unioned. Single-source funnels (the common case) are unchanged, so the person UUID actor id is preserved there. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🎭 Playwright didn't run on this PR — your changes touch code that could affect E2E behavior, but Playwright is opt-in via label now to keep CI cost down. Add the Most PRs don't need this. Real regressions still get caught on master and fix-forward. |
Automated code reviewScoped fix that resolves the Critical Issues
Functional Gaps
Convention Violations
Performance Notes
Improvements Suggested
Positive Observations
Overall AssessmentRequest Changes — the funnel-summary fix is sound, but add (or explicitly rule out) coverage for the mixed-funnel actors/persons drill-down before merge, since the Verdict: Needs changes |
Problem
A funnel that combines series from more than one source table — e.g. a regular events step plus a data-warehouse step — failed the whole query with ClickHouse
Code: 386 ... no supertype for types UUID, String(NO_COMMON_TYPE). Surfaced fromsystem.query_logas part of the effort to reduce deterministic query-builder bugs (dashboard). Closes #58710.The funnel builds one subquery per source table and combines them with
UNION ALL. Each source resolvesaggregation_targetto its own type — the events series usesperson_id(UUID), a data-warehouse series uses its configured column (often a string).UNION ALLrequires a common column type, and there is no supertype forUUIDandString.Changes
funnel_event_query.py: when more than one source query is unioned, coerce every branch'saggregation_targetto a string (toString(...)).person_idUUID actor id is preserved there.How did you test this code?
I'm an agent. Automated tests run locally:
test_funnels_data_warehouse_and_regular_nodes_string_aggregation_target— a mixed events + data-warehouse funnel whose warehouse series aggregates by a plain string column. Verified it fails (NO_COMMON_TYPE) without the fix and passes with it.test_funnel_data_warehouse.pysuite — 10 passed; 2 snapshots updated (theaggregation_targetcolumns of multi-source funnels now carry atoString(...)wrap).Publish to changelog?
no
🤖 Agent context
Authored by Claude Code (Opus 4.7). Found via
system.query_loganalysis (exception_code = 386,no supertype for types UUID, String).The coercion is gated on
len(queries) > 1— it only applies when sources are actually unioned, so it cannot regress the type of a single-source funnel's actor id. For a genuinely mixed funnel the actor id is already heterogeneous (person UUIDs and warehouse strings), so a uniform string is the correct common type; the funnel step counts are unaffected sincetoStringis a bijection on the values.Agent-authored; requires human review.