CREATE DATABASE IF NOT EXISTS internal_platform_db; -- Input table CREATE TABLE IF NOT EXISTS internal_platform_db.t_sh_event_log_v2_06000061157_prestosql_002 ( ftime STRING, extinfo STRING, ad_version STRING, guid STRING, ch STRING, first_date STRING, last_date STRING, click_date STRING, attribution STRING, conversion_date STRING, conversion_type STRING, creativeset_id STRING, org_id STRING, campaign_id STRING, adgroup_id STRING, keyword_id STRING, country_oregion STRING, enter_ag_time STRING, installed_finish_time STRING, start_download_time STRING, sub_channel STRING, callback STRING, task_id STRING, sub_task_id STRING, rta_id STRING, device_id STRING, ext_info1 STRING, ext_info2 STRING, caid STRING, claim_type STRING, ai_assistant_device_id STRING, ds STRING ) STORED AS ORC; INSERT INTO TABLE internal_platform_db.t_sh_event_log_v2_06000061157_prestosql_002 VALUES ('2026-06-09', '', 'ad_attribution', 'guid001', 'ch1', '2026-06-01', '2026-06-09', '2026-06-05', 'true', '2026-06-09', 'install', 'cs001', 'org001', 'camp001', 'ag001', 'kw001', 'US', '2026-06-05', '2026-06-05', '2026-06-05', 'sub1', '', 't001', 'st001', 'rta001', 'qimei001', '', '', 'caid001', '', '', '2026060919'), ('2026-06-09', '', 'ad_attribution', 'guid002', 'ch2', '2026-06-01', '2026-06-09', '2026-06-06', 'true', '2026-06-09', 'install', 'cs002', 'org002', 'camp002', 'ag002', 'kw002', 'US', '2026-06-06', '2026-06-06', '2026-06-06', 'sub2', '', 't002', 'st002', 'rta002', 'qimei002', '', '', 'caid002', '', '', '2026060919'), ('2026-06-09', '', 'ad_attribution', 'guid001', 'ch1', '2026-06-02', '2026-06-09', '2026-06-07', 'true', '2026-06-09', 'install', 'cs003', 'org003', 'camp003', 'ag003', 'kw003', 'US', '2026-06-07', '2026-06-07', '2026-06-07', 'sub1', '', 't003', 'st003', 'rta003', 'qimei001', '', '', 'caid003', '', '', '2026060919'), ('2026-06-09', '', 'phonebrandh', 'guid003', 'ch3', '2026-06-01', '2026-06-09', '2026-06-05', '', '2026-06-09', 'install', 'cs004', 'org004', 'camp004', 'ag004', 'kw004', 'CN', '2026-06-05', '2026-06-05', '2026-06-05', 'sub3', 'callback_huawei_1', 't004', 'st004', 'rta004', 'qimei003', '', '', 'caid004', '', '', '2026060919'), ('2026-06-09', '', 'phonebrandh', 'guid004', 'ch4', '2026-06-01', '2026-06-09', '2026-06-06', '', '2026-06-09', 'install', 'cs005', 'org005', 'camp005', 'ag005', 'kw005', 'CN', '2026-06-06', '2026-06-06', '2026-06-06', 'sub4', 'callback_huawei_2', 't005', 'st005', 'rta005', 'qimei004', '', '', 'caid005', '', '', '2026060919'), ('2026-06-09', '', 'phonebrandh', 'guid003', 'ch3', '2026-06-02', '2026-06-09', '2026-06-07', '', '2026-06-09', 'install', 'cs006', 'org006', 'camp006', 'ag006', 'kw006', 'CN', '2026-06-07', '2026-06-07', '2026-06-07', 'sub3', 'callback_huawei_3', 't006', 'st006', 'rta006', 'qimei003', '', '', 'caid006', '', '', '2026060919'), ('2026-06-09', '', 'ad_attribution', 'guid005', 'ch5', '2026-06-01', '2026-06-09', '', 'false', '2026-06-09', 'install', 'cs007', 'org007', 'camp007', 'ag007', 'kw007', 'US', '2026-06-05', '2026-06-05', '2026-06-05', 'sub5', '', 't007', 'st007', 'rta007', 'qimei005', '', '', 'caid007', '', '', '2026060919'), ('2026-06-09', '', 'phonebrandh', 'guid006', 'ch6', '2026-06-01', '2026-06-09', '', '', '2026-06-09', 'install', 'cs008', 'org008', 'camp008', 'ag008', 'kw008', 'CN', '2026-06-05', '2026-06-05', '2026-06-05', 'sub6', '', 't008', 'st008', 'rta008', 'qimei006', '', '', 'caid008', '', '', '2026060919'), ('2026-06-08', '', 'ad_attribution', 'guid007', 'ch1', '2026-06-01', '2026-06-08', '2026-06-05', 'true', '2026-06-08', 'install', 'cs009', 'org009', 'camp009', 'ag009', 'kw009', 'US', '2026-06-05', '2026-06-05', '2026-06-05', 'sub1', '', 't009', 'st009', 'rta009', 'qimei007', '', '', 'caid009', '', '', '2026060819'); -- GT output table CREATE TABLE IF NOT EXISTS internal_platform_db.t_my_ads_tracking_log_metrics_prestosql_002 ( ds BIGINT, ad_version STRING, media_id INT, log_num BIGINT, log_num_qimei BIGINT ) STORED AS ORC; -- Candidate output table CREATE TABLE IF NOT EXISTS internal_platform_db.t_my_ads_tracking_log_metrics_cand_prestosql_002 ( ds BIGINT, ad_version STRING, media_id INT, log_num BIGINT, log_num_qimei BIGINT ) STORED AS ORC;