数据预处理拆分sql

此SQL脚本用于华为视频效果监控,处理点击和展示数据,生成报表,包括地域推荐和为您推荐场景的点击、用户转换率等指标。脚本涉及到数据解析、创建临时表、数据聚合以及将结果写入外部表。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >



# --------------------------------------------------------------------------------------------------------
#  @FileName: test_ads_rcm_movie_effect_monitoring_dm.sql
#  @CopyRight: copyright(c)huawei technologies co.,ltd.1998-2017.all rights reserved.
#  @Purpose: 华为视频效果监控报表
#  @Describe:获取地域推荐及为您推荐各场景下的点击转换率及用户转换率
#  @Input: dwd_evt_bisdk_customize_dm,0,0;ads_persona_label_0level_dev_relevant_ds,0,0;
#  @Output: test_ads_rcm_movie_effect_monitoring_dm
#  @Author: ywx402796
#  @Version: Video(2.0.2,2.0.3)
#  @Create: 2017-11-25
# ---------------------------------------------------------------------------------------------------------

beeline -e"
use biads;
##点击数据解析
DROP TABLE IF EXISTS temp.tmp_rcm_ywx402796_$date_client_column_video_click_ds;
create table if not exists temp.tmp_rcm_ywx402796_$date_client_column_video_click_ds as
select t.imei,t.oper_id,
        get_json_object(t.non_stru_field,'$.toType') as toType,
        if(t.non_stru_field rlike 'toID',get_json_object(t.non_stru_field,'$.toID'),'') as toID,
        if(t.non_stru_field rlike 'fromType',get_json_object(t.non_stru_field,'$.fromType'),'') as fromType,
        if(t.non_stru_field rlike 'fromID',get_json_object(t.non_stru_field,'$.fromID'),'') as fromID,
        if(t.non_stru_field rlike 'fromAlgId',get_json_object(t.non_stru_field,'$.fromAlgId'),'') as fromAlgId,
        if(t.non_stru_field rlike 'userId',get_json_object(t.non_stru_field,'$.userId'),'') as userId      
from
(select imei,oper_id,regexp_replace(non_stru_field,'\\\\^','\\,') as non_stru_field
from bicoredata.dwd_evt_bisdk_customize_dm where pt_d=${start_time,-2,yyyyMMdd} and pt_service='movie' and oper_id='V001')t;
##展示数据解析
DROP TABLE IF EXISTS temp.tmp_rcm_ywx402796_$date_client_column_video_show_ds;
create table if not exists temp.tmp_rcm_ywx402796_$date_client_column_video_show_ds as
select
     t.imei
    ,t.oper_id
    ,t.userId
    ,t.viewID
    ,t.viewType
    ,t.categoryID
    ,split(a.content,'\\\\|')[0] as contentid
    ,split(a.content,'\\\\|')[1] as fromalgid 
from
(
    select
         t.imei
        ,t.oper_id
        ,t.userId
        ,t.viewID
        ,t.viewType
        ,if(t.contList rlike 'categoryID',get_json_object(t.contList,'$.categoryID'),'') as categoryID
        ,if(t.contList rlike 'content',get_json_object(t.contList,'$.content'),'') as content
    from
    (
        select
            t.imei
           ,t.oper_id
           ,t.userId
     &

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值