--- id: offline-compute_MySQL_mysql_011 name: Low-Value Task Benefit Aggregation Statistics by Application Group category: offline-compute/MySQL timeout_seconds: 1800 modality: pure-text engine: mysql --- ## Prompt Task Objective: Summarize the current day's actual and estimated benefit metrics for low-value tasks, grouped by planning product, operations product, OBS product, and application group dimensions. **Business Background and Objective**: Low-value task governance requires summarizing the current day's actual benefits (task count, runtime, CPU, memory) and estimated benefits (task count, runtime, CPU, memory) at the application group level to evaluate governance effectiveness. This task groups the detail data from the specified partition of the input table by four dimension fields, applies SUM aggregation to all metric fields, and writes the results to the output table. **Input Table (full name + brief description)**: - `internal_platform_db.dws_low_value_task_compute_statistics_day_mysql_011` (low-value task compute benefit detail daily table) (Please connect to the database and query to confirm the table structure and field semantics.) **Processing Rules**: - No joins, single-table processing - Filter condition: `dt = '20260507'` - Aggregation logic: Group by `plan_product_name`, `obs_product_name`, `product_name`, `dw_appgroup`, applying SUM to all metric fields (`actural_task_count`, `actural_time_sum_hour`, `actural_vcore_sum_vcore_hour`, `actural_memory_sum_gb_hour`, `estimated_task_count`, `estimated_time_sum_hour`, `estimated_vcore_sum_vcore_hour`, `estimated_memory_sum_gb_hour`) **Output Requirements**: - Target table: `internal_platform_db.dws_low_value_task_compute_appgroup_stats_day_cand_mysql_011` - Output field order: `dt`, `plan_product_name`, `obs_product_name`, `product_name`, `dw_appgroup`, `actural_task_count`, `actural_time_sum_hour`, `actural_vcore_sum_vcore_hour`, `actural_memory_sum_gb_hour`, `estimated_task_count`, `estimated_time_sum_hour`, `estimated_vcore_sum_vcore_hour`, `estimated_memory_sum_gb_hour` - `dt` field value: `'20260507'` - Types: `dt` VARCHAR(8), `plan_product_name` VARCHAR(256), `obs_product_name` VARCHAR(256), `product_name` VARCHAR(256), `dw_appgroup` VARCHAR(256), `actural_task_count` INT, `actural_time_sum_hour` DOUBLE, `actural_vcore_sum_vcore_hour` DOUBLE, `actural_memory_sum_gb_hour` DOUBLE, `estimated_task_count` INT, `estimated_time_sum_hour` DOUBLE, `estimated_vcore_sum_vcore_hour` DOUBLE, `estimated_memory_sum_gb_hour` DOUBLE - If the target table does not exist, first create it using standard MySQL InnoDB format, then write the data - Use standard MySQL syntax; do not use Hive/Spark SQL dialects (e.g., `INSERT OVERWRITE`, `STORED AS ORC`, `PARTITIONED BY` are not supported) - Write method: Use `INSERT INTO ... SELECT ...` statements **Environment and Execution Notes**: - Your final output must be written to the file `/tmp_workspace/result.py`, not `result.sql` - The local MySQL is running at localhost:3306, username `root`, password `root123` - Use Python `pymysql` in `result.py` to execute the SQL (do not use the `mysql` command-line tool) - The script must include complete table creation (if the target table does not exist) and data writing logic - After writing `result.py`, you must execute `python3 /tmp_workspace/result.py` yourself to verify that it runs successfully and produces correct data