DROP TABLE public.ods_payment_order;
CREATE TABLE public.ods_payment_order (
    appid bigint NOT NULL,
    app_ver text,
    sdk_ver text,
    channel text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_id text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text,
    order_id text NOT NULL,
    amount bigint,
    platform text,
    servid text,
    role_id text,
    prodid text,
    prod_name text,
    status integer NOT NULL,
    ds text NOT NULL
    ,PRIMARY KEY (appid, order_id, status)
) WITH (
orientation = 'column',
storage_format = 'orc',
binlog_level = 'replica',
binlog_ttl = '604800',
bitmap_columns = 'appid,device_id,servid,order_id,user_id,status,ds,event_time',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);
COMMENT ON COLUMN public.ods_payment_order.status IS '0预支付/1已支付';
COMMENT ON COLUMN public.ods_payment_order.ds IS 'yyyymmdd';



DROP TABLE public.ods_active_role;
CREATE TABLE public.ods_active_role (
    appid bigint NOT NULL,
    channel text NOT NULL,
    role_id text NOT NULL,
    ds text NOT NULL,
    app_ver text,
    sdk_ver text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_id text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text,
    servid text,
    job_id text,
    role_level text,
    role_name text,
    job_name text,
    server_name text
    ,PRIMARY KEY (appid, channel, role_id, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'appid,ds',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid,role_id,ds',
table_storage_mode = 'any',
time_to_live_in_seconds = '31536000'
);


DROP TABLE public.ads_app_statis_md;
CREATE TABLE public.ads_app_statis_md (
    appid integer NOT NULL,
    app_ver text NOT NULL,
    channel text NOT NULL,
    newly_device bigint,
    newly_account bigint,
    active_device bigint,
    active_account bigint,
    payment_device bigint,
    payment_account bigint,
    order_created bigint,
    order_amount bigint,
    order_payment bigint,
    ds text NOT NULL,
    new_role_users bigint,
    new_roles bigint,
    new_pay_account bigint,
    new_ac_amount bigint,
    new_ac_pay_num bigint,
    new_pay_user bigint,
    new_user_amount bigint,
    payment_order bigint
    ,PRIMARY KEY ( appid, app_ver, channel, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'app_ver,channel,ds',
dictionary_encoding_columns = 'app_ver:auto,channel:auto,ds:auto',
distribution_key = 'appid,app_ver,channel,ds',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);
COMMENT ON COLUMN public.ads_app_statis_md.newly_device IS '新增设备';
COMMENT ON COLUMN public.ads_app_statis_md.newly_account IS '新增账号';
COMMENT ON COLUMN public.ads_app_statis_md.active_device IS '活跃设备';
COMMENT ON COLUMN public.ads_app_statis_md.active_account IS '活跃账号';
COMMENT ON COLUMN public.ads_app_statis_md.payment_device IS '付费设备';
COMMENT ON COLUMN public.ads_app_statis_md.payment_account IS '付费账号';
COMMENT ON COLUMN public.ads_app_statis_md.order_created IS '创建订单数';
COMMENT ON COLUMN public.ads_app_statis_md.order_amount IS '订单总金额';
COMMENT ON COLUMN public.ads_app_statis_md.order_payment IS '订单实付款';
COMMENT ON COLUMN public.ads_app_statis_md.ds IS '统计月份yyyy-mm';
COMMENT ON COLUMN public.ads_app_statis_md.new_role_users IS '新增创角账号数';
COMMENT ON COLUMN public.ads_app_statis_md.new_roles IS '新增创建角色数';
COMMENT ON COLUMN public.ads_app_statis_md.new_pay_account IS '新增付费账号数';
COMMENT ON COLUMN public.ads_app_statis_md.new_ac_amount IS '新增付费金额（账号）';
COMMENT ON COLUMN public.ads_app_statis_md.new_ac_pay_num IS '新增付费次数';
COMMENT ON COLUMN public.ads_app_statis_md.new_pay_user IS '新增付费用户数';
COMMENT ON COLUMN public.ads_app_statis_md.new_user_amount IS '新增付费用户付费金额';
COMMENT ON COLUMN public.ads_app_statis_md.payment_order IS '付费订单数';


DROP TABLE public.rpt_app_statis_pd;
CREATE TABLE public.rpt_app_statis_pd (
    appid integer NOT NULL,
    app_ver text NOT NULL,
    channel text NOT NULL,
    ds text NOT NULL,
    active_device bigint,
    newly_device bigint,
    start_device bigint,
    newly_account bigint,
    active_account bigint,
    payment_device bigint,
    payment_account bigint,
    order_created bigint,
    order_amount bigint,
    order_payment bigint,
    total_device bigint,
    newly_distinct bigint,
    active_distinct bigint,
    new_role_users bigint,
    new_roles bigint,
    new_pay_account bigint,
    new_ac_amount bigint,
    new_ac_pay_num bigint,
    new_pay_user bigint,
    new_user_amount bigint,
    payment_order bigint,
    total_amount bigint,
    orig_active_device bigint,
    orig_payment_amount bigint,
    orig_total_amount bigint,
    orig_newly_payment_device bigint default 0,
    total_payment_order bigint default 0,
    total_payment_device bigint default 0,
    dbl_newly_device bigint default 0,
    dbl_newly_account bigint default 0,
    nd_old_account bigint default 0,
    login_account bigint default 0,
    newly_account_role bigint,
    rollserv_account bigint,
    rollserv_u_role bigint,
    rollserv_u_payment_account bigint,
    rollserv_u_order_payment bigint,
    rollserv_u_order_amount bigint,
    role_newly_account bigint
    ,PRIMARY KEY ( appid, app_ver, channel, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'app_ver,channel,ds,appid',
clustering_key = 'ds:asc',
dictionary_encoding_columns = 'app_ver:auto,channel:auto,ds:auto',
distribution_key = 'appid',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);



COMMENT ON TABLE public.rpt_app_statis_pd IS NULL;
COMMENT ON COLUMN public.rpt_app_statis_pd.active_device IS '活跃设备';
COMMENT ON COLUMN public.rpt_app_statis_pd.newly_device IS '新增设备';
COMMENT ON COLUMN public.rpt_app_statis_pd.start_device IS '启动次数';
COMMENT ON COLUMN public.rpt_app_statis_pd.newly_account IS '新增账号';
COMMENT ON COLUMN public.rpt_app_statis_pd.active_account IS '活跃账号';
COMMENT ON COLUMN public.rpt_app_statis_pd.payment_device IS '付费设备';
COMMENT ON COLUMN public.rpt_app_statis_pd.payment_account IS '付费账号';
COMMENT ON COLUMN public.rpt_app_statis_pd.order_created IS '创建订单数';
COMMENT ON COLUMN public.rpt_app_statis_pd.order_amount IS '订单总金额';
COMMENT ON COLUMN public.rpt_app_statis_pd.order_payment IS '订单实付款';
COMMENT ON COLUMN public.rpt_app_statis_pd.total_device IS '累计设备';
COMMENT ON COLUMN public.rpt_app_statis_pd.newly_distinct IS '新增独立';
COMMENT ON COLUMN public.rpt_app_statis_pd.active_distinct IS '活跃独立';
COMMENT ON COLUMN public.rpt_app_statis_pd.new_role_users IS '创角的账号总数';
COMMENT ON COLUMN public.rpt_app_statis_pd.new_roles IS '新增角色数';
COMMENT ON COLUMN public.rpt_app_statis_pd.new_pay_account IS '新增付费账号数';
COMMENT ON COLUMN public.rpt_app_statis_pd.new_ac_amount IS '新增账号付费金额';
COMMENT ON COLUMN public.rpt_app_statis_pd.new_ac_pay_num IS '新增账号付费定单数';
COMMENT ON COLUMN public.rpt_app_statis_pd.new_pay_user IS '新增付费金额（设备）';
COMMENT ON COLUMN public.rpt_app_statis_pd.new_user_amount IS '新增付费用户付费金额';
COMMENT ON COLUMN public.rpt_app_statis_pd.payment_order IS '付费订单数';
COMMENT ON COLUMN public.rpt_app_statis_pd.total_amount IS '累计充值';
COMMENT ON COLUMN public.rpt_app_statis_pd.orig_active_device IS '源渠道活跃设备';
COMMENT ON COLUMN public.rpt_app_statis_pd.orig_payment_amount IS '源渠道充值金额';
COMMENT ON COLUMN public.rpt_app_statis_pd.orig_total_amount IS '源渠道累计充值';
COMMENT ON COLUMN public.rpt_app_statis_pd.orig_newly_payment_device IS '源渠道新增付费设备';
COMMENT ON COLUMN public.rpt_app_statis_pd.total_payment_order IS '累计付费订单数';
COMMENT ON COLUMN public.rpt_app_statis_pd.total_payment_device IS '累计付费设备数';
COMMENT ON COLUMN public.rpt_app_statis_pd.dbl_newly_device IS '双新设备数';
COMMENT ON COLUMN public.rpt_app_statis_pd.dbl_newly_account IS '双新账号数';
COMMENT ON COLUMN public.rpt_app_statis_pd.nd_old_account IS '新设备老账号设备数';
COMMENT ON COLUMN public.rpt_app_statis_pd.login_account IS '登录账号数';
COMMENT ON COLUMN public.rpt_app_statis_pd.newly_account_role IS '新账号创角数';
COMMENT ON COLUMN public.rpt_app_statis_pd.rollserv_account IS '滚服账号数';
COMMENT ON COLUMN public.rpt_app_statis_pd.rollserv_u_role IS '滚服账号创角数';
COMMENT ON COLUMN public.rpt_app_statis_pd.rollserv_u_payment_account IS '滚服账号付费账号数';
COMMENT ON COLUMN public.rpt_app_statis_pd.rollserv_u_order_payment IS '滚服账号订单数';
COMMENT ON COLUMN public.rpt_app_statis_pd.rollserv_u_order_amount IS '滚服账号订单金额';
COMMENT ON COLUMN public.rpt_app_statis_pd.role_newly_account IS '创角的新账号数';


DROP TABLE public.rpt_app_statis_pw;
CREATE TABLE public.rpt_app_statis_pw (
    appid integer NOT NULL,
    app_ver text NOT NULL,
    channel text NOT NULL,
    ds text NOT NULL,
    active_device bigint,
    newly_device bigint,
    start_device bigint,
    newly_account bigint,
    active_account bigint,
    payment_device bigint,
    payment_account bigint,
    order_created bigint,
    order_amount bigint,
    order_payment bigint,
    total_device bigint,
    newly_distinct bigint,
    active_distinct bigint,
    new_role_users bigint,
    new_roles bigint,
    new_pay_account bigint,
    new_ac_amount bigint,
    new_ac_pay_num bigint,
    new_pay_user bigint,
    new_user_amount bigint,
    payment_order bigint,
    total_amount bigint,
    orig_active_device bigint,
    orig_payment_amount bigint,
    orig_total_amount bigint,
    orig_newly_payment_device bigint default 0,
    total_payment_order bigint default 0,
    total_payment_device bigint default 0,
    dbl_newly_device bigint default 0,
    dbl_newly_account bigint default 0,
    nd_old_account bigint default 0,
    login_account bigint default 0,
    newly_account_role bigint,
    rollserv_account bigint,
    rollserv_u_role bigint,
    rollserv_u_payment_account bigint,
    rollserv_u_order_payment bigint,
    rollserv_u_order_amount bigint,
    role_newly_account bigint
    ,PRIMARY KEY ( appid, app_ver, channel, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'app_ver,channel,ds',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);
COMMENT ON TABLE public.rpt_app_statis_pw IS NULL;
COMMENT ON COLUMN public.rpt_app_statis_pw.active_device IS '活跃设备';
COMMENT ON COLUMN public.rpt_app_statis_pw.newly_device IS '新增设备';
COMMENT ON COLUMN public.rpt_app_statis_pw.start_device IS '启动次数';
COMMENT ON COLUMN public.rpt_app_statis_pw.newly_account IS '新增账号';
COMMENT ON COLUMN public.rpt_app_statis_pw.active_account IS '活跃账号';
COMMENT ON COLUMN public.rpt_app_statis_pw.payment_device IS '付费设备';
COMMENT ON COLUMN public.rpt_app_statis_pw.payment_account IS '付费账号';
COMMENT ON COLUMN public.rpt_app_statis_pw.order_created IS '创建订单数';
COMMENT ON COLUMN public.rpt_app_statis_pw.order_amount IS '订单总金额';
COMMENT ON COLUMN public.rpt_app_statis_pw.order_payment IS '订单实付款';
COMMENT ON COLUMN public.rpt_app_statis_pw.total_device IS '累计设备';
COMMENT ON COLUMN public.rpt_app_statis_pw.newly_distinct IS '新增独立';
COMMENT ON COLUMN public.rpt_app_statis_pw.active_distinct IS '活跃独立';
COMMENT ON COLUMN public.rpt_app_statis_pw.new_role_users IS '创角新用户数';
COMMENT ON COLUMN public.rpt_app_statis_pw.new_roles IS '新增角色数';
COMMENT ON COLUMN public.rpt_app_statis_pw.new_pay_account IS '新增付费账号数';
COMMENT ON COLUMN public.rpt_app_statis_pw.new_ac_amount IS '新增账号付费金额';
COMMENT ON COLUMN public.rpt_app_statis_pw.new_ac_pay_num IS '新增账号付费定单数';
COMMENT ON COLUMN public.rpt_app_statis_pw.new_pay_user IS '新增付费用户数';
COMMENT ON COLUMN public.rpt_app_statis_pw.new_user_amount IS '新增付费用户付费金额';
COMMENT ON COLUMN public.rpt_app_statis_pw.payment_order IS '付费订单数';
COMMENT ON COLUMN public.rpt_app_statis_pw.total_amount IS '累计充值';
COMMENT ON COLUMN public.rpt_app_statis_pw.orig_active_device IS '源渠道活跃设备';
COMMENT ON COLUMN public.rpt_app_statis_pw.orig_payment_amount IS '源渠道充值金额';
COMMENT ON COLUMN public.rpt_app_statis_pw.orig_total_amount IS '源渠道累计充值';
COMMENT ON COLUMN public.rpt_app_statis_pw.orig_newly_payment_device IS '源渠道新增付费设备';
COMMENT ON COLUMN public.rpt_app_statis_pw.total_payment_order IS '累计付费订单数';
COMMENT ON COLUMN public.rpt_app_statis_pw.total_payment_device IS '累计付费设备数';
COMMENT ON COLUMN public.rpt_app_statis_pw.dbl_newly_device IS '双新设备数';
COMMENT ON COLUMN public.rpt_app_statis_pw.dbl_newly_account IS '双新账号数';
COMMENT ON COLUMN public.rpt_app_statis_pw.nd_old_account IS '新设备老账号设备数';
COMMENT ON COLUMN public.rpt_app_statis_pw.login_account IS '登录账号数';
COMMENT ON COLUMN public.rpt_app_statis_pw.newly_account_role IS '新账号创角数';
COMMENT ON COLUMN public.rpt_app_statis_pw.rollserv_account IS '滚服账号数';
COMMENT ON COLUMN public.rpt_app_statis_pw.rollserv_u_role IS '滚服账号创角数';
COMMENT ON COLUMN public.rpt_app_statis_pw.rollserv_u_payment_account IS '滚服账号付费账号数';
COMMENT ON COLUMN public.rpt_app_statis_pw.rollserv_u_order_payment IS '滚服账号订单数';
COMMENT ON COLUMN public.rpt_app_statis_pw.rollserv_u_order_amount IS '滚服账号订单金额';




DROP TABLE public.ods_active_account;
CREATE TABLE public.ods_active_account (
    appid bigint NOT NULL,
    channel text NOT NULL,
    user_id text NOT NULL,
    ds text NOT NULL,
    app_ver text,
    sdk_ver text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_width integer,
    device_height integer,
    device_id text,
    device_lang text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    servid text,
    role_id text
    ,PRIMARY KEY (appid, channel, user_id, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
binlog_level = 'replica',
binlog_ttl = '604800',
bitmap_columns = 'appid,user_id,event_time,ds',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_storage_mode = 'any',
time_to_live_in_seconds = '31536000'
);


DROP TABLE public.ods_payment_object;
CREATE TABLE public.ods_payment_object (
    appid bigint NOT NULL,
    channel text NOT NULL,
    typd text NOT NULL,
    typv text NOT NULL,
    ds text NOT NULL,
    app_ver text,
    event_time bigint
    ,PRIMARY KEY (appid, channel, typd, typv, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
binlog_level = 'replica',
binlog_ttl = '604800',
bitmap_columns = 'typd,ds,event_time',
dictionary_encoding_columns = '',
distribution_key = 'ds',
table_storage_mode = 'any',
time_to_live_in_seconds = '10368000'
);



DROP TABLE public.ods_active_device;
CREATE TABLE public.ods_active_device (
    appid bigint NOT NULL,
    channel text NOT NULL,
    device_id text NOT NULL,
    ds text NOT NULL,
    app_ver text,
    sdk_ver text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_width integer,
    device_height integer,
    device_lang text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text,
    servid text,
    role_id text
    ,PRIMARY KEY (appid, device_id, channel, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
binlog_level = 'replica',
binlog_ttl = '604800',
bitmap_columns = 'appid,device_id,event_time,ds',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_storage_mode = 'any',
time_to_live_in_seconds = '10368000'
);


DROP TABLE public.ods_newly_account;

CREATE TABLE public.ods_newly_account (
    appid bigint NOT NULL,
    app_ver text,
    sdk_ver text,
    channel text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_width integer,
    device_height integer,
    device_id text,
    device_lang text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text NOT NULL,
    ds text NOT NULL
    ,PRIMARY KEY (appid, user_id)
) WITH (
orientation = 'column',
storage_format = 'orc',
binlog_level = 'replica',
binlog_ttl = '604800',
bitmap_columns = 'appid,user_id,event_time,ds',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);



DROP TABLE public.rpt_app_statis_rt;

CREATE TABLE public.rpt_app_statis_rt (
    appid bigint NOT NULL,
    app_ver text NOT NULL,
    channel text NOT NULL,
    start_device bigint,
    rt_active_device bigint,
    active_device bigint,
    newly_device bigint,
    active_account bigint,
    newly_account bigint,
    order_created bigint,
    order_amount bigint,
    order_payment bigint,
    payment_device bigint,
    payment_account bigint,
    payment_amount bigint,
    newly_role_account bigint,
    newly_role bigint,
    newly_payment_account bigint,
    newly_payment_amount bigint,
    newly_order_payment bigint,
    newly_payment_device bigint,
    newly_device_payment_amount bigint,
    orig_active_device bigint,
    orig_payment_amount bigint,
    orig_total_amount bigint,
    orig_newly_payment_device bigint,
    total_device bigint,
    total_amount bigint,
    total_payment_order bigint,
    total_payment_device bigint,
    dbl_newly_device bigint,
    dbl_newly_account bigint,
    nd_old_account bigint,
    login_account bigint,
    newly_account_role bigint,
    hh text,
    hm text NOT NULL,
    ds text NOT NULL,
    role_newly_account bigint,
    rollserv_account bigint,
    rollserv_u_role bigint,
    rollserv_u_payment_account bigint,
    rollserv_u_order_payment bigint,
    rollserv_u_order_amount bigint,
    rt_active_account bigint,
    rt_payment_account bigint,
    rt_newly_payment_account bigint
    ,PRIMARY KEY ( appid, app_ver, channel, hm, ds)
) WITH (
orientation = 'row,column',
storage_format = 'sst,orc',
bitmap_columns = 'appid,app_ver,channel,hh,hm,ds',
dictionary_encoding_columns = '',
distribution_key = 'ds,appid',
table_storage_mode = 'any',
time_to_live_in_seconds = '777600'
);
COMMENT ON COLUMN public.rpt_app_statis_rt.start_device IS '启动次数';
COMMENT ON COLUMN public.rpt_app_statis_rt.rt_active_device IS '活跃次数';
COMMENT ON COLUMN public.rpt_app_statis_rt.active_device IS '活跃设备';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_device IS '新增设备';
COMMENT ON COLUMN public.rpt_app_statis_rt.active_account IS '活跃账号';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_account IS '新增账号';
COMMENT ON COLUMN public.rpt_app_statis_rt.order_created IS '创建订单数';
COMMENT ON COLUMN public.rpt_app_statis_rt.order_amount IS '订单总金额';
COMMENT ON COLUMN public.rpt_app_statis_rt.order_payment IS '付款订单数';
COMMENT ON COLUMN public.rpt_app_statis_rt.payment_device IS '付费设备';
COMMENT ON COLUMN public.rpt_app_statis_rt.payment_account IS '付费账号';
COMMENT ON COLUMN public.rpt_app_statis_rt.payment_amount IS '付费金额';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_role_account IS '创角账号数';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_role IS '新增创角数';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_payment_account IS '新增付费账号数';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_payment_amount IS '新增付费金额（账号）';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_order_payment IS '新增付费次数（账号）';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_payment_device IS '新增付费数（设备）';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_device_payment_amount IS '新增付费金额（设备）';
COMMENT ON COLUMN public.rpt_app_statis_rt.orig_active_device IS '源渠道活跃设备';
COMMENT ON COLUMN public.rpt_app_statis_rt.orig_payment_amount IS '源渠道充值金额';
COMMENT ON COLUMN public.rpt_app_statis_rt.orig_total_amount IS '源渠道累计充值';
COMMENT ON COLUMN public.rpt_app_statis_rt.orig_newly_payment_device IS '源渠道新增付费设备';
COMMENT ON COLUMN public.rpt_app_statis_rt.total_device IS '昨日累计设备';
COMMENT ON COLUMN public.rpt_app_statis_rt.total_amount IS '昨日累计充值';
COMMENT ON COLUMN public.rpt_app_statis_rt.total_payment_order IS '累计付费订单数';
COMMENT ON COLUMN public.rpt_app_statis_rt.total_payment_device IS '累计付费设备数';
COMMENT ON COLUMN public.rpt_app_statis_rt.dbl_newly_device IS '双新设备数';
COMMENT ON COLUMN public.rpt_app_statis_rt.dbl_newly_account IS '双新账号数';
COMMENT ON COLUMN public.rpt_app_statis_rt.nd_old_account IS '新设备老账号设备数';
COMMENT ON COLUMN public.rpt_app_statis_rt.login_account IS '登录账号数';
COMMENT ON COLUMN public.rpt_app_statis_rt.newly_account_role IS '新账号创角数';
COMMENT ON COLUMN public.rpt_app_statis_rt.role_newly_account IS '创角的新账号数';
COMMENT ON COLUMN public.rpt_app_statis_rt.rollserv_u_role IS '滚服账号创角数';
COMMENT ON COLUMN public.rpt_app_statis_rt.rollserv_u_payment_account IS '滚服账号付费账号数';
COMMENT ON COLUMN public.rpt_app_statis_rt.rollserv_u_order_payment IS '滚服账号订单数';
COMMENT ON COLUMN public.rpt_app_statis_rt.rollserv_u_order_amount IS '滚服账号订单金额';



DROP TABLE public.ods_newly_role;
CREATE TABLE public.ods_newly_role (
    appid bigint NOT NULL,
    app_ver text,
    sdk_ver text,
    channel text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_id text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text,
    servid text,
    role_id text NOT NULL,
    ds text NOT NULL,
    job_id text,
    role_level text,
    role_name text,
    job_name text,
    server_name text
    ,PRIMARY KEY (appid, role_id)
) WITH (
orientation = 'row,column',
storage_format = 'sst,orc',
bitmap_columns = 'appid,user_id,servid,ds,event_time',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_group = 'sdk_statis_tg_s80',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);



DROP TABLE public.rpt_app_statis_pm;
CREATE TABLE public.rpt_app_statis_pm (
    appid integer NOT NULL,
    app_ver text NOT NULL,
    channel text NOT NULL,
    ds text NOT NULL,
    active_device bigint,
    newly_device bigint,
    start_device bigint,
    newly_account bigint,
    active_account bigint,
    payment_device bigint,
    payment_account bigint,
    order_created bigint,
    order_amount bigint,
    order_payment bigint,
    total_device bigint,
    newly_distinct bigint,
    active_distinct bigint,
    new_role_users bigint,
    new_roles bigint,
    new_pay_account bigint,
    new_ac_amount bigint,
    new_ac_pay_num bigint,
    new_pay_user bigint,
    new_user_amount bigint,
    payment_order bigint,
    total_amount bigint,
    orig_active_device bigint,
    orig_payment_amount bigint,
    orig_total_amount bigint,
    orig_newly_payment_device bigint default 0,
    total_payment_order bigint default 0,
    total_payment_device bigint default 0,
    dbl_newly_device bigint default 0,
    dbl_newly_account bigint default 0,
    nd_old_account bigint default 0,
    login_account bigint default 0,
    newly_account_role bigint,
    rollserv_account bigint,
    rollserv_u_role bigint,
    rollserv_u_payment_account bigint,
    rollserv_u_order_payment bigint,
    rollserv_u_order_amount bigint,
    role_newly_account bigint
    ,PRIMARY KEY ( appid, app_ver, channel, ds)
) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'app_ver,channel,ds',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);
COMMENT ON COLUMN public.rpt_app_statis_pm.active_device IS '活跃设备';
COMMENT ON COLUMN public.rpt_app_statis_pm.newly_device IS '新增设备';
COMMENT ON COLUMN public.rpt_app_statis_pm.start_device IS '启动次数';
COMMENT ON COLUMN public.rpt_app_statis_pm.newly_account IS '新增账号';
COMMENT ON COLUMN public.rpt_app_statis_pm.active_account IS '活跃账号';
COMMENT ON COLUMN public.rpt_app_statis_pm.payment_device IS '付费设备';
COMMENT ON COLUMN public.rpt_app_statis_pm.payment_account IS '付费账号';
COMMENT ON COLUMN public.rpt_app_statis_pm.order_created IS '创建订单数';
COMMENT ON COLUMN public.rpt_app_statis_pm.order_amount IS '订单总金额';
COMMENT ON COLUMN public.rpt_app_statis_pm.order_payment IS '订单实付款';
COMMENT ON COLUMN public.rpt_app_statis_pm.total_device IS '累计设备';
COMMENT ON COLUMN public.rpt_app_statis_pm.newly_distinct IS '新增独立';
COMMENT ON COLUMN public.rpt_app_statis_pm.active_distinct IS '活跃独立';
COMMENT ON COLUMN public.rpt_app_statis_pm.new_role_users IS '创角新用户数';
COMMENT ON COLUMN public.rpt_app_statis_pm.new_roles IS '新增角色数';
COMMENT ON COLUMN public.rpt_app_statis_pm.new_pay_account IS '新增付费账号数';
COMMENT ON COLUMN public.rpt_app_statis_pm.new_ac_amount IS '新增账号付费金额';
COMMENT ON COLUMN public.rpt_app_statis_pm.new_ac_pay_num IS '新增账号付费定单数';
COMMENT ON COLUMN public.rpt_app_statis_pm.new_pay_user IS '新增付费用户数';
COMMENT ON COLUMN public.rpt_app_statis_pm.new_user_amount IS '新增付费用户付费金额';
COMMENT ON COLUMN public.rpt_app_statis_pm.payment_order IS '付费订单数';
COMMENT ON COLUMN public.rpt_app_statis_pm.total_amount IS '累计充值';
COMMENT ON COLUMN public.rpt_app_statis_pm.orig_active_device IS '源渠道活跃设备';
COMMENT ON COLUMN public.rpt_app_statis_pm.orig_payment_amount IS '源渠道充值金额';
COMMENT ON COLUMN public.rpt_app_statis_pm.orig_total_amount IS '源渠道累计充值';
COMMENT ON COLUMN public.rpt_app_statis_pm.orig_newly_payment_device IS '源渠道新增付费设备';
COMMENT ON COLUMN public.rpt_app_statis_pm.total_payment_order IS '累计付费订单数';
COMMENT ON COLUMN public.rpt_app_statis_pm.total_payment_device IS '累计付费设备数';
COMMENT ON COLUMN public.rpt_app_statis_pm.dbl_newly_device IS '双新设备数';
COMMENT ON COLUMN public.rpt_app_statis_pm.dbl_newly_account IS '双新账号数';
COMMENT ON COLUMN public.rpt_app_statis_pm.nd_old_account IS '新设备老账号设备数';
COMMENT ON COLUMN public.rpt_app_statis_pm.login_account IS '登录账号数';
COMMENT ON COLUMN public.rpt_app_statis_pm.newly_account_role IS '新账号创角数';
COMMENT ON COLUMN public.rpt_app_statis_pm.rollserv_account IS '滚服账号数';
COMMENT ON COLUMN public.rpt_app_statis_pm.rollserv_u_role IS '滚服账号创角数';
COMMENT ON COLUMN public.rpt_app_statis_pm.rollserv_u_payment_account IS '滚服账号付费账号数';
COMMENT ON COLUMN public.rpt_app_statis_pm.rollserv_u_order_payment IS '滚服账号订单数';
COMMENT ON COLUMN public.rpt_app_statis_pm.rollserv_u_order_amount IS '滚服账号订单金额';



DROP TABLE public.ods_newly_device;
CREATE TABLE public.ods_newly_device (
    appid bigint NOT NULL,
    app_ver text,
    sdk_ver text,
    channel text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_width integer,
    device_height integer,
    device_id text NOT NULL,
    device_lang text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text,
    ds text NOT NULL
    ,PRIMARY KEY (appid, device_id)
) WITH (
orientation = 'column',
storage_format = 'orc',
binlog_level = 'replica',
binlog_ttl = '604800',
bitmap_columns = 'appid,device_id,ds',
clustering_key = 'ds:asc',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);


DROP TABLE public.ods_rollserv_account_r;
CREATE TABLE public.ods_rollserv_account_r (
    appid integer,
    app_ver text,
    sdk_ver text,
    channel text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_id text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text,
    servid text,
    role_id text,
    job_id text,
    role_level text,
    role_name text,
    job_name text,
    ds text
) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'appid,channel,user_id,ds',
dictionary_encoding_columns = '',
distribution_key = 'appid',
table_group = 'sdk_statis_tg_s80',
table_storage_mode = 'any',
time_to_live_in_seconds = '604800'
);


DROP TABLE public.ods_rollserv_account;

CREATE TABLE public.ods_rollserv_account (
    appid integer,
    app_ver text,
    sdk_ver text,
    channel text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_id text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_time bigint,
    user_id text,
    servid text,
    role_id text,
    job_id text,
    role_level text,
    role_name text,
    job_name text,
    ds date NOT NULL
)
  LOGICAL PARTITION BY LIST (ds) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'app_ver,sdk_ver,channel,country,province,city,isp,ip,device_id,device_model,device_brand,device_os,device_type,user_id,servid,role_id,job_id,role_level,role_name,job_name',
dictionary_encoding_columns = 'app_ver:auto,sdk_ver:auto,channel:auto,country:auto,province:auto,city:auto,isp:auto,ip:auto,device_id:auto,device_model:auto,device_brand:auto,device_os:auto,device_type:auto,user_id:auto,servid:auto,role_id:auto,job_id:auto,role_level:auto,role_name:auto,job_name:auto',
distribution_key = 'appid',
partition_expiration_time = '720 hour',
segment_key = 'ds',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);


DROP TABLE public.ods_game_pm_log;

CREATE TABLE public.ods_game_pm_log (
    appid bigint NOT NULL,
    app_id text NOT NULL,
    app_ver text,
    sdk_ver text,
    channel text NOT NULL,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_width integer,
    device_height integer,
    device_id text NOT NULL,
    device_lang text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_name text NOT NULL,
    event_type text,
    event_time timestamp with time zone NOT NULL,
    net_type text,
    user_id text,
    order_id text,
    amount bigint,
    platform text,
    status integer,
    servid text,
    server_name text,
    role_id text,
    role_name text,
    role_level text,
    job_id text,
    job_name text,
    var1 text,
    var2 text,
    var3 text,
    var4 text,
    var5 text,
    var6 text,
    var7 text,
    var8 text,
    var9 text,
    var10 text,
    var11 text,
    var12 text,
    var13 text,
    var14 text,
    var15 text,
    var16 text,
    var17 text,
    var18 text,
    var19 text,
    var20 text,
    var21 text,
    var22 text,
    var23 text,
    var24 text,
    var25 text,
    var26 text,
    var27 text,
    var28 text,
    var29 text,
    var30 text,
    ds date NOT NULL,
    prodid text,
    prod_name text,
    sub_servid text,
    sub_server_name text
)
  LOGICAL PARTITION BY LIST (ds) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'app_id,app_ver,sdk_ver,channel,country,province,city,isp,ip,device_id,device_lang,device_model,device_brand,device_os,device_type,event_name,event_type,net_type,user_id,order_id,platform,servid,server_name,role_id,role_name,role_level,job_id,job_name,var1,var2,var3,var4,var5,var6,var7,var8,var9,var10,var11,var12,var13,var14,var15,var16,var17,var18,var19,var20,var21,var22,var23,var24,var25,var26,var27,var28,var29,var30,prodid,prod_name,sub_servid,sub_server_name',
dictionary_encoding_columns = 'app_id:auto,app_ver:auto,sdk_ver:auto,channel:auto,country:auto,province:auto,city:auto,isp:auto,ip:auto,device_id:auto,device_lang:auto,device_model:auto,device_brand:auto,device_os:auto,device_type:auto,event_name:auto,event_type:auto,net_type:auto,user_id:auto,order_id:auto,platform:auto,servid:auto,server_name:auto,role_id:auto,role_name:auto,role_level:auto,job_id:auto,job_name:auto,var1:auto,var2:auto,var3:auto,var4:auto,var5:auto,var6:auto,var7:auto,var8:auto,var9:auto,var10:auto,var11:auto,var12:auto,var13:auto,var14:auto,var15:auto,var16:auto,var17:auto,var18:auto,var19:auto,var20:auto,var21:auto,var22:auto,var23:auto,var24:auto,var25:auto,var26:auto,var27:auto,var28:auto,var29:auto,var30:auto,prodid:auto,prod_name:auto,sub_servid:auto,sub_server_name:auto',
distribution_key = 'app_id',
partition_expiration_time = '384 hour',
partition_require_filter = 'true',
segment_key = 'event_time',
table_group = 'sdk_statis_tg_s80',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);


DROP TABLE public.ods_track_log;
CREATE TABLE public.ods_track_log (
    appid bigint NOT NULL,
    app_id text NOT NULL,
    app_ver text,
    sdk_ver text,
    channel text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_width integer,
    device_height integer,
    device_id text NOT NULL,
    device_lang text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_name text NOT NULL,
    event_type text,
    event_time bigint NOT NULL,
    net_type text,
    user_id text,
    order_id text,
    amount bigint,
    platform text,
    status integer,
    servid text,
    server_name text,
    role_id text,
    role_name text,
    role_level text,
    job_id text,
    job_name text,
    var1 text,
    var2 text,
    var3 text,
    var4 text,
    var5 text,
    var6 text,
    var7 text,
    var8 text,
    var9 text,
    var10 text,
    var11 text,
    var12 text,
    var13 text,
    var14 text,
    var15 text,
    var16 text,
    var17 text,
    var18 text,
    var19 text,
    var20 text,
    var21 text,
    var22 text,
    var23 text,
    var24 text,
    var25 text,
    var26 text,
    var27 text,
    var28 text,
    var29 text,
    var30 text,
    ds date NOT NULL,
    prodid text,
    prod_name text,
    sub_servid text,
    sub_server_name text
)
  LOGICAL PARTITION BY LIST (ds) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'app_id,app_ver,sdk_ver,channel,country,province,city,isp,ip,device_id,device_lang,device_model,device_brand,device_os,device_type,event_name,event_type,net_type,user_id,order_id,platform,servid,server_name,role_id,role_name,role_level,job_id,job_name,var1,var2,var3,var4,var5,var6,var7,var8,var9,var10,var11,var12,var13,var14,var15,var16,var17,var18,var19,var20,var21,var22,var23,var24,var25,var26,var27,var28,var29,var30,prodid,prod_name,sub_servid,sub_server_name',
dictionary_encoding_columns = 'app_id:auto,app_ver:auto,sdk_ver:auto,channel:auto,country:auto,province:auto,city:auto,isp:auto,ip:auto,device_id:auto,device_lang:auto,device_model:auto,device_brand:auto,device_os:auto,device_type:auto,event_name:auto,event_type:auto,net_type:auto,user_id:auto,order_id:auto,platform:auto,servid:auto,server_name:auto,role_id:auto,role_name:auto,role_level:auto,job_id:auto,job_name:auto,var1:auto,var2:auto,var3:auto,var4:auto,var5:auto,var6:auto,var7:auto,var8:auto,var9:auto,var10:auto,var11:auto,var12:auto,var13:auto,var14:auto,var15:auto,var16:auto,var17:auto,var18:auto,var19:auto,var20:auto,var21:auto,var22:auto,var23:auto,var24:auto,var25:auto,var26:auto,var27:auto,var28:auto,var29:auto,var30:auto,prodid:auto,prod_name:auto,sub_servid:auto,sub_server_name:auto',
distribution_key = 'appid',
partition_expiration_time = '8880 hour',
partition_require_filter = 'true',
segment_key = 'ds',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);
COMMENT ON TABLE public.ods_track_log IS '日志明细表';
COMMENT ON COLUMN public.ods_track_log.device_brand IS 'from device_model';
COMMENT ON COLUMN public.ods_track_log.status IS '-1非支付事件/0预支付/1已支付';



DROP TABLE public.ods_track_log4dur;
CREATE TABLE public.ods_track_log4dur (
    appid bigint NOT NULL,
    app_id text NOT NULL,
    app_ver text,
    sdk_ver text,
    channel text,
    country text,
    province text,
    city text,
    isp text,
    ip text,
    device_width integer,
    device_height integer,
    device_id text NOT NULL,
    device_lang text,
    device_model text,
    device_brand text,
    device_os text,
    device_type text,
    event_name text NOT NULL,
    event_type text,
    event_time bigint NOT NULL,
    net_type text,
    user_id text,
    order_id text,
    amount bigint,
    platform text,
    status integer,
    servid text,
    server_name text,
    role_id text,
    role_name text,
    role_level text,
    job_id text,
    job_name text,
    var1 text,
    var2 text,
    var3 text,
    var4 text,
    var5 text,
    var6 text,
    var7 text,
    var8 text,
    var9 text,
    var10 text,
    var11 text,
    var12 text,
    var13 text,
    var14 text,
    var15 text,
    var16 text,
    var17 text,
    var18 text,
    var19 text,
    var20 text,
    var21 text,
    var22 text,
    var23 text,
    var24 text,
    var25 text,
    var26 text,
    var27 text,
    var28 text,
    var29 text,
    var30 text,
    ds date NOT NULL,
    prodid text,
    prod_name text,
    sub_servid text,
    sub_server_name text
)
  LOGICAL PARTITION BY LIST (ds) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'app_id,app_ver,sdk_ver,channel,country,province,city,isp,ip,device_id,device_lang,device_model,device_brand,device_os,device_type,event_name,event_type,net_type,user_id,order_id,platform,servid,server_name,role_id,role_name,role_level,job_id,job_name,var1,var2,var3,var4,var5,var6,var7,var8,var9,var10,var11,var12,var13,var14,var15,var16,var17,var18,var19,var20,var21,var22,var23,var24,var25,var26,var27,var28,var29,var30,prodid,prod_name,sub_servid,sub_server_name',
dictionary_encoding_columns = 'app_id:auto,app_ver:auto,sdk_ver:auto,channel:auto,country:auto,province:auto,city:auto,isp:auto,ip:auto,device_id:auto,device_lang:auto,device_model:auto,device_brand:auto,device_os:auto,device_type:auto,event_name:auto,event_type:auto,net_type:auto,user_id:auto,order_id:auto,platform:auto,servid:auto,server_name:auto,role_id:auto,role_name:auto,role_level:auto,job_id:auto,job_name:auto,var1:auto,var2:auto,var3:auto,var4:auto,var5:auto,var6:auto,var7:auto,var8:auto,var9:auto,var10:auto,var11:auto,var12:auto,var13:auto,var14:auto,var15:auto,var16:auto,var17:auto,var18:auto,var19:auto,var20:auto,var21:auto,var22:auto,var23:auto,var24:auto,var25:auto,var26:auto,var27:auto,var28:auto,var29:auto,var30:auto,prodid:auto,prod_name:auto,sub_servid:auto,sub_server_name:auto',
distribution_key = 'appid',
partition_expiration_time = '168 hour',
partition_require_filter = 'true',
segment_key = 'ds',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);



DROP TABLE datasci.dws_role_churn_map_task_d;

CREATE TABLE datasci.dws_role_churn_map_task_d (
    appid integer NOT NULL,
    servid text NOT NULL,
    server_name text,
    user_id text NOT NULL,
    role_id text NOT NULL,
    ds date NOT NULL,
    role_level text,
    map text,
    task text,
    victor_name text,
    death_person_cnt integer,
    death_enemy_cnt integer,
    event_time timestamp with time zone NOT NULL
)
  LOGICAL PARTITION BY LIST (ds) WITH (
orientation = 'column',
storage_format = 'orc',
bitmap_columns = 'servid,server_name,user_id,role_id,role_level,map,task,victor_name',
dictionary_encoding_columns = 'servid:auto,server_name:auto,user_id:auto,role_id:auto,role_level:auto,map:auto,task:auto,victor_name:auto',
distribution_key = 'appid',
partition_expiration_time = '720 hour',
partition_require_filter = 'true',
segment_key = 'event_time',
table_storage_mode = 'any',
time_to_live_in_seconds = '3153600000'
);
