Datasets:
File size: 1,608 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 31 32 33 34 35 36 | ---
id: offline-compute_HiveSQL_hivesql_024
name: 从 internal_platform_db.dwd_relationship_strength_fe
category: offline-compute/HiveSQL
timeout_seconds: 600
modality: pure-text
engine: hivesql
---
## Prompt
任务目标
基于好友关系特征数据计算关系强度推荐分数,输出每个用户对(uin, touin)的加权评分结果。
输入
- internal_platform_db.dwd_relationship_strength_features_v4_di_query_engine_138(无 Join,单表处理)
处理规则
1. 过滤条件:imp_date = 20260608,且 uin >= 10000 且 touin >= 10000
2. 特征处理:
- 对所有分数字段使用 COALESCE(field, 0) 填充空值
- c2c_cnt_score、common_frd_num、frd_tag_num 使用 LOG(1 + field) 变换
- age_diff 使用 LOG(100 - age_diff) 变换
3. 加权求和公式:score = (0.0327 * log_frd_tag_num + 0.0386 * touser_id_active_layer + 0.0853 * (1 - is_same_city) + 0.0564 * c2c_score + 0.1895 * log_c2c_cnt_score + 0.2455 * socialzone_visit_score + 0.1055 * socialzone_like_score + 0.1514 * socialzone_comment_score + 0.1556 * profile_view_score + 0.1531 * profile_like_score) / 28
4. 结果字段:raw_score = ROUND(score, 4),最终 score = 1 + ROUND(score, 4) * 10000
输出要求
- 字段顺序:imp_date(固定值 20260608)、uin、touin、score、raw_score
- imp_date 作为分区字段
- 不要求去重或聚合
写入要求
- 输出表:internal_platform_db.ads_qq_sq_frd_recommendation_result_list_df_cand_query_engine_138
- 分区:imp_date = 20260608
- 写入方式:INSERT OVERWRITE 覆盖写入该分区
请将最终 HiveSQL 写入 result.sql 并执行。
|