Datasets:
metadata
id: offline-compute_PrestoSQL_prestosql_003
name: IM平台Q群离线报告子分区过滤
category: offline-compute/PrestoSQL
timeout_seconds: 900
modality: pure-text
engine: prestosql
Prompt
任务目标:从IM平台Q群离线报告原始日志中,筛选指定appid下包含"诈骗"标签的记录,提取关键字段写入输出表。
输入表:
internal_platform_db.dwd_t_event_log_v1_05900072467_with_subpartition_hi_prestosql_003(IM平台Q群离线报告原始日志)databus_imp_dateSTRING — 数据日期ftimeSTRING — 时间appidSTRING — 应用IDmessage_idSTRING — 消息IDreqbodySTRING — 请求体(JSON)contentSTRING — 内容model_idSTRING — 模型IDgroup_numSTRING — 群号punish_path_nameSTRING — 处罚路径名称ext_field1STRING — 扩展字段1ext_field2STRING — 扩展字段2dsBIGINT — 分区字段
过滤条件:
appid = '100553'reqbody IS NOT NULLget_json_object(reqbody, '$.tag_info') IS NOT NULLget_json_object(reqbody, '$.tag_info.tag_result_text') LIKE '%诈骗-%'ftime = '20250324'
输出要求:
- 目标表:
internal_platform_db.dwd_qqgroup_offline_report_cand_prestosql_003 - 输出字段及顺序:
ftimeSTRING,appidSTRING,model_idSTRING,message_idSTRING,databus_imp_dateSTRING,group_numSTRING,punish_path_nameSTRING,contentSTRING - appid 固定值 '101069'
- model_id 固定值 'IM平台Qgroup_zhapian_report_1049'
- 如果目标表不存在,请先建表再写入数据
- 请使用Presto/Trino SQL语法,不要使用Hive/Spark SQL方言
- 注意:Presto中使用json_extract_scalar代替get_json_object
环境与执行说明:
- Presto已启动,通过Hive catalog连接
- 执行SQL:
presto-cli --catalog hive --schema internal_platform_db -f /tmp_workspace/result.sql - 写出result.sql后,必须自己执行验证它能成功运行并产出正确数据