fix(ingestion): normalize CRM UNION branch types to fix NO_COMMON_TYPE (#1709, #1708) - #1861
Merged
cyberantonz merged 1 commit intoJul 23, 2026
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 03ffe03e3221e1c412f2825fe7e83fee3950b901 and f4fdf29. 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughCRM SQL models explicitly cast Salesforce event durations to ChangesCRM numeric type normalization
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
constructorfabric#1709, constructorfabric#1708) Two CRM UNIONs mixed incompatible numeric types, so a branch failed `NO_COMMON_TYPE` (ClickHouse Code 386): - salesforce__crm_activities (constructorfabric#1709): tasks emit `duration_seconds` as Int64 (`toInt64(CallDurationInSeconds)`), events as Float64 (`DurationInMinutes * 60`) — and Airbyte infers DurationInMinutes as a float on real syncs. Cast events to `toInt64(DurationInMinutes * 60)` so both branches (and the hubspot sibling, which is Int64) share one type; the silver union_by_tag over both connectors stays consistent too. - crm_bullet_rows gold view (constructorfabric#1708): the `deal_size` branch passed `coalesce(d.amount_home, 0)` (Decimal(38,9)) while the other five UNION branches are Float64, so `CREATE OR REPLACE VIEW` threw at migration time and aborted every later migration. Wrap it in `toFloat64(...)`. Both are pre-existing latent bugs masked only by Int64/Float64-typed demo bronze; they fire on real Salesforce/HubSpot data (or the placeholder Decimal deal schema). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Anton Zelenov <antonz@constructor.tech>
cyberantonz
force-pushed
the
fix/crm-union-no-common-type
branch
from
July 23, 2026 05:22
03ffe03 to
f4fdf29
Compare
ktursunov
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1709. Closes #1708.
Two CRM
UNIONs mix incompatible numeric types, so a branch failsNO_COMMON_TYPE(ClickHouse Code 386). Both are pre-existing and masked only by the Int64/Float64-typed demo bronze; they fire on real Salesforce/HubSpot data.#1709 —
salesforce__crm_activities(staging)The
tasksCTE emitsduration_secondsas Int64 (toInt64(CallDurationInSeconds)); theeventsCTE emits Float64 (DurationInMinutes * 60) because Airbyte infersDurationInMinutesas a float on real syncs → thetasks UNION ALL eventshas no supertype andclass_crm_activitiesnever builds (drops all CRM activity metrics).Fix:
toInt64(DurationInMinutes * 60). Int64 (not Float64) is deliberate — thehubspot__crm_activitiessibling that unions into the samesilver.class_crm_activities(viaunion_by_tag) already emitsNullable(Int64), so normalizing to Int64 keeps the cross-connector union consistent too.#1708 —
crm_bullet_rows(gold view, migration)The
deal_sizebranch passedcoalesce(d.amount_home, 0)(Decimal(38,9)) while the other five UNION branches are Float64. ClickHouse resolves view column types atCREATE, soCREATE OR REPLACE VIEWthrew — and since it runs inside20260512000000_crm-gold-views.sql, every later migration silently never applied.Fix:
toFloat64(coalesce(d.amount_home, 0))(matches the sibling branches; no-op when already Float64).Verification
Static: both casts align each branch with its sibling/consumer type. The e2e
metricslane will confirm the models/gold still build. Note the current fixtures mask these (Int64/Float64-typed demo bronze) — a float-DurationInMinutes/ Decimal-amount_homefixture would exercise the failing path directly and is a good follow-up.🤖 Generated with Claude Code
Summary by CodeRabbit