Datasets:
metadata
id: offline-compute_HiveSQL_hivesql_023
name: >-
Compute multi-dimensional CUBE aggregation of user open-start-path data by
referer_type, referer, and path
category: offline-compute/HiveSQL
timeout_seconds: 600
modality: pure-text
engine: hivesql
Prompt
Task Objective: Compute multi-dimensional aggregation metrics from the user open-start-path detail table, outputting UV and first-time UV across three dimension combinations: application category (referer_type), source application (referer), and launch path (path).
Inputs:
internal_platform_db.t_ed_mapservice_user_open_start_path_dwd_di_query_engine_135internal_platform_db.t_ed_mapservice_user_q36_active_dwd_di_query_engine_135
Processing Rules:
- Main table filter:
ds=20260608, andreferermust be in the specified lists of application package names/keys for three categories (FoodChainA, QuickDog, JD). - Path cleansing: Process the
pathfield according to rules — if it matchesqqmap://map/routeplan?type=\w+, retain the original value; if it contains?, truncate to the part before the question mark; if it is empty/null/'NULL', set it to'未知'; otherwise, retain the original value. referer_typemapping: Map thereferervalue to one of three categories:'FoodChainA','CourierCoB'(QuickDog), or'EcommerceC'(JD).- Join: Join with
t_ed_mapservice_user_q36_active_dwd_di_query_engine_135(ds=20260608,uindeduplicated) onuin, retaining active users. - Aggregation: Group by
referer_type,CUBE(referer, path), computingcount(distinct uin)asuvandcount(distinct case when is_first=1 then uin end)asfirst_uv. - CUBE result processing: For dimensions where
groupingis 1, set the value to'total'.
Output Requirements:
- Field order:
referer_type,referer,path,uv,first_uv,ds refererandpathdisplay as'total'on CUBE summary rowsuvis of type BIGINT,first_uvis of type BIGINT
Write Requirements:
- Output table:
internal_platform_db.t_md_mapservice_user_open_start_path_dwa_di_cand_query_engine_135 - Partition:
ds=20260608 - Write method:
INSERT OVERWRITE
Please write the final HiveSQL to result.sql and execute it.