Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WITH source_data AS (
- SELECT user::Int64 AS user_id, value, ts
- FROM wimc.mp_userSetting
- WHERE name = 'circles_concept_enabled'
- AND ts >= '2025-06-01'
- ),
- mart_data AS (
- SELECT user_id, value, ts
- FROM stat.user_setting_history
- WHERE name = 'circles_concept_enabled'
- AND ts >= '2025-06-01'
- ),
- joined AS (
- SELECT
- s.user_id,
- s.value AS source_value,
- m.value AS mart_value,
- s.ts,
- m.user_id AS matched_user
- FROM source_data s
- LEFT JOIN mart_data m
- ON s.user_id = m.user_id AND s.ts = m.ts
- )
- SELECT
- countIf(matched_user = 0) AS missing_in_clickhouse,
- countIf(matched_user != 0 AND source_value != mart_value) AS value_mismatch,
- count() AS total_records_in_source
- FROM joined;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement