Datasets:
metadata
id: offline-compute_PrestoSQL_prestosql_011
name: 安全平台PG敏感接口2表UNION+聚合
category: offline-compute/PrestoSQL
timeout_seconds: 900
modality: pure-text
engine: prestosql
Prompt
任务目标:将两个安全平台PG敏感接口数据表合并,排除黑名单域名后,按日期、域名和接口路径聚合,将匹配规则名拼接为逗号分隔字符串,写入输出表。
输入表:(2个表结构相同)
internal_platform_db.internal_sec_radept_secpg_data_result2_prestosql_011internal_platform_db.internal_sec_radept_secpg_data_result4_prestosql_011
各表字段:
databus_imp_dateINT — 数据日期insert_timeSTRING — 插入时间src_ipSTRING — 源IPemployeenameSTRING — 员工名http_hostSTRING — 域名http_cgiSTRING — 接口路径http_paramSTRING — 请求参数http_user_agentSTRING — 用户代理http_refererSTRING — 来源http_bodySTRING — 请求体http_headSTRING — 请求头httpsrsp_bodySTRING — 响应体httpsrsp_content_lengthSTRING — 响应内容长度https_methodSTRING — HTTPS方法scan_groupSTRING — 扫描组rule_nameSTRING — 规则名match_stringSTRING — 匹配字符串match_typeSTRING — 匹配类型scan_commentSTRING — 扫描备注
过滤条件:
databus_imp_date = 20260608http_host NOT IN ('api.im-platform.example.com', 'mp.im-platform.example.com', 'open.im-platform.example.com', 'wx.im.example.com', 'wx2.im.example.com', 'wx8.im.example.com', 'web.im-platform.example.com', 'login.im-platform.example.com', 'long.open.im-platform.example.com', 'ext.im.example.com', 'proxy.svc.example.com', 'resolver.svc.example.com', 'cloud.provider.example.com', 'console.cloud.provider.example.com', 'csec.cloud.provider.example.com')
输出要求:
- 目标表:
internal_platform_db.secpg_sensitive_interface_cand_prestosql_011 - 输出字段及顺序:
databus_imp_dateINT,http_hostSTRING,http_cgiSTRING,con_conSTRING - con_con: listagg(rule_name, ',') 或 array_join(array_agg(DISTINCT rule_name), ',') 聚合规则名
- 按 databus_imp_date, http_host, http_cgi 分组
- 如果目标表不存在,请先建表再写入数据
- 请使用Presto/Trino SQL语法,不要使用Hive/Spark SQL方言
环境与执行说明:
- Presto已启动,通过Hive catalog连接
- 执行SQL:
presto-cli --catalog hive --schema internal_platform_db -f /tmp_workspace/result.sql - 写出result.sql后,必须自己执行验证它能成功运行并产出正确数据