File size: 2,056 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_022
name:  internal_platform_db.log_16159_query_engine_134 表中提取审核数据,过滤 ds=202
category: offline-compute/HiveSQL
timeout_seconds: 600
modality: pure-text
engine: hivesql
---
## Prompt
任务目标:将日志表中符合特定条件的审核记录解析并转码,生成包含标签名称的可读审核结果表。

输入:
- internal_platform_db.log_16159_query_engine_134(包含审核日志字段:ds, functype_, actiontype_, othercol1_, resultinfo_, auditid_, operator_, strategyid_, orderid_, providerid_, uniqueauditid_, audittime_, createtime_, receivetime_, queue_label_)

处理规则:
1. 过滤条件:ds=2026060916、functype_=2141、actiontype_=3
2. 字段提取(使用正则):
   - 从 othercol1_ 提取:bizuin(regexp_extract(othercol1_, 'bizuin:(.*?);'))、nickname(regexp_extract(othercol1_, 'nickname:(.*?);'))
   - 从 resultinfo_ 提取:account_tag 字符串(regexp_extract(resultinfo_, 'account_tag:(.*?);')),按 '\*sc\*' 分割为 account_tag1、account_tag2、account_tag3;remark(regexp_extract(resultinfo_, 'remark:(.*?);'))
3. 时间格式转换:audittime_、createtime_、receivetime_ 从 Unix 时间戳转为 yyyyMMddHH 格式
4. Join 操作:定义硬编码标签映射表(label_name 和 label 两列,包含约 100 条映射),对 account_tag1、account_tag2、account_tag3 分别 LEFT JOIN 映射表,得到 account_tag1_string、account_tag2_string、account_tag3_string

输出要求:
- 字段顺序:ds, bizuin, nickname, account_tag1, account_tag2, account_tag3, account_tag1_string, account_tag2_string, account_tag3_string, remark, auditid_, operator_, strategyid_, orderid_, providerid_, uniqueauditid_, audittime, createtime_, receivetime_, queue_label_
- 分区字段:ds=2026060916

写入要求:INSERT OVERWRITE 到 internal_platform_db.dwmid_daily_ecommerce_shop_level_func_2141_audit_result_cand_query_engine_134 的 ds=2026060916 分区。

请将最终 HiveSQL 写入 result.sql 并执行。