Datasets:
File size: 2,302 Bytes
e8c001c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ---
id: offline-compute_PrestoSQL_prestosql_008
name: Report WUID Detail Filtering
category: offline-compute/PrestoSQL
timeout_seconds: 900
modality: pure-text
engine: prestosql
---
## Prompt
**Task Objective**: From the ad report WUID detail wide table, filter target ad delivery records based on multi-dimensional filter conditions, extract key fields, and write the results to the output table.
**Input Table**:
- `internal_platform_db.t_report_wuid_detail_d_prestosql_008` (report WUID detail table)
- `wuid` STRING — user identifier
- `product_id` STRING — product ID
- `adgroup_id` BIGINT — ad group ID
- `action_time` BIGINT — action time
- `crm_id` BIGINT — CRM ID
- `creative_id` BIGINT — creative ID
- `ocpx_conversion_cnt` BIGINT — oCpx conversion count
- `optimization_goal` INT — optimization goal
- `second_optimization_goal` INT — second-level optimization goal
- `roi_goal` INT — ROI goal
- `product_type` INT — product type
- `site_set` INT — site set
- `crm_advertiser_industry_id` BIGINT — CRM advertiser industry ID
- `label` INT — label
- `partition_time` BIGINT — partition time
- `ds` BIGINT — partition field
**Filter Conditions**:
- `partition_time = 20260608`
- `ocpx_conversion_cnt = 0`
- `optimization_goal IN (105, 603)`
- `second_optimization_goal = 0`
- `roi_goal = 7`
- `product_type = 46`
- `site_set = 21`
- `product_id IS NOT NULL`
- `crm_advertiser_industry_id != 0`
- `creative_id != 0`
**Output Requirements**:
- Target table: `internal_platform_db.sdk_sample_pay_neg_mini_cand_prestosql_008`
- Output fields and order: `wuid` STRING, `product_id` STRING, `adgroup_id` BIGINT, `action_time` BIGINT, `crm_id` BIGINT, `creative_id` BIGINT, `label` INT, `product_type` INT, `optimization_goal` INT, `roi_goal` INT, `partition_time` BIGINT
- If the target table does not exist, first create the table, then write the data
- Use Presto/Trino SQL syntax; do not use Hive/Spark SQL dialects
**Environment and Execution Notes**:
- Presto is running, connected via the Hive catalog
- Execute SQL: `presto-cli --catalog hive --schema internal_platform_db -f /tmp_workspace/result.sql`
- After writing `result.sql`, you must execute it yourself to verify that it runs successfully and produces correct data
|