Datasets:
File size: 1,446 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 | ---
id: offline-compute_HiveSQL_hivesql_015
name: From internal_platform_db.t_mg_dws_user_tag_preset_241
category: offline-compute/HiveSQL
timeout_seconds: 600
modality: pure-text
engine: hivesql
---
## Prompt
Task Objective: Incrementally insert new user records (`user_id`, `loss_day`) into the `ds=20260608` partition of the target table that have not appeared before.
Inputs:
- `internal_platform_db.t_mg_dws_user_tag_preset_24128_query_engine_103` (source table, containing fields such as `ds`, `user_id`, `loss_day`)
- `internal_platform_db.t_mg_dws_user_tag_user_id_once_24128_query_engine_103` (existing users table, containing previously written `user_id` values)
Processing Rules:
1. Select records from the source table `internal_platform_db.t_mg_dws_user_tag_preset_24128_query_engine_103` where `ds=20260608`
2. Use a `NOT IN` subquery to exclude `user_id` values that already exist in the existing users table `internal_platform_db.t_mg_dws_user_tag_user_id_once_24128_query_engine_103` (deduplication condition: `user_id`)
3. Extract fields: `user_id`, `loss_day`
Output Requirements:
- Output field order: `user_id`, `loss_day`
- No deduplication needed (duplicates are already filtered out via `NOT IN`)
Write Requirements:
- Target table: `internal_platform_db.t_mg_dws_user_tag_user_id_once_24128_cand_query_engine_103`
- Write method: `INSERT INTO` (append)
Please write the final HiveSQL to `result.sql` and execute it.
|