Datasets:
File size: 1,674 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 | ---
id: offline-compute_HiveSQL_hivesql_001
name: Message Queue Topic Dimension Table internal_platform_db.dim_mq_topic_d_su
category: offline-compute/HiveSQL
timeout_seconds: 600
modality: pure-text
engine: hivesql
---
## Prompt
**Task Objective**: Read data from the previous day's partition of the input table and copy it as-is to the output table's current day partition.
**Time Variables**: The platform provides these variables for dynamic date computation:
- `${yyyymmdd}` : current day in YYYYMMDD format
- `${yyyymmdd-1}` : previous day in YYYYMMDD format
- You may also use Spark SQL built-in functions like `current_date()` and `date_sub()`.
**Input**: `internal_platform_db.dim_mq_topic_d_query_engine_001` (a partitioned table, partitioned by `dt`).
**Processing Rules**: 1) Select all data where the `dt` partition equals the previous day (use `${yyyymmdd-1}`); 2) No joins, single-table processing; 3) All fields are retained as-is, with no transformations or filtering.
**Output Requirements**: Output all non-partition columns: `business_id`, `business_name`, `cluster_set`, `tenant`, `namespaces`, `topic`, `mq_type`, `dw_appgroup`, `in_charge`, `description`, `create_time`, `modify_time`, `cluster_id`, `cluster_type`, `cluster_name`, `bg`, `category_name`, `is_filtered`, `tids`, `consumed_tids`, `unconsumed_tids`, `is_fully_consumed`, `has_unconsumed_tid`, `system_belong`; partitioned by the `dt` field.
**Write Requirements**: Use `INSERT OVERWRITE` to write to the current day partition (use `${yyyymmdd}`) of `internal_platform_db.dim_mq_topic_d_copilot_cand_query_engine_001`.
Please write the final HiveSQL to `result.sql` and execute it.
|