CREATE TABLE ods_anti_plugin (
appid int NOT NULL,
channel_id int,
device_id VARCHAR NOT NULL,
game_id int,
servid bigint,
user_id VARCHAR,
role_id VARCHAR,
ip VARCHAR,
location VARCHAR,
env_risk VARCHAR,
plug_risk VARCHAR,
other_risk VARCHAR,
event_time DATETIME NOT NULL
)
 ENGINE=OLAP
DISTRIBUTED BY HASH(`appid`) BUCKETS 32;


CREATE TABLE ods_apm_crash (
guid bigint NOT NULL,
errno VARCHAR,
gmid bigint,
appid bigint,
app_id VARCHAR,
app_ver VARCHAR,
app_pkg VARCHAR,
sdk_ver VARCHAR,
channel VARCHAR,
country VARCHAR,
province VARCHAR,
city VARCHAR,
isp VARCHAR,
ip VARCHAR,
device_width int,
device_height int,
device_id VARCHAR,
device_lang VARCHAR,
device_model VARCHAR,
device_brand VARCHAR,
device_os VARCHAR,
device_type VARCHAR,
cpu_abi VARCHAR,
device_ram int,
avail_ram int,
device_hdd int,
avail_hdd int,
is_root smallint,
is_front smallint,
battery_temp VARCHAR,
cpu_usage VARCHAR,
use_time bigint,
crash_file VARCHAR,
crash_type VARCHAR,
brief_content VARCHAR,
brief_title VARCHAR,
is_parsed smallint,
net_type VARCHAR,
user_id VARCHAR,
server_id VARCHAR,
report_time DATETIME NOT NULL
)
UNIQUE KEY (guid) DISTRIBUTED BY HASH (guid) BUCKETS 32;



CREATE TABLE ods_event_analyze_task (
id bigint NOT NULL,
task_type VARCHAR NOT NULL,
code VARCHAR NOT NULL,
params VARCHAR NOT NULL,
run_type int,
cron_express VARCHAR
)
UNIQUE KEY (id, task_type) DISTRIBUTED BY HASH (id) BUCKETS 32;



CREATE TABLE ods_game_pm_log (
gmid bigint NOT NULL,
appid bigint NOT NULL,
app_id VARCHAR NOT NULL,
app_ver VARCHAR,
sdk_ver VARCHAR,
channel VARCHAR NOT NULL,
country VARCHAR,
province VARCHAR,
city VARCHAR,
isp VARCHAR,
ip VARCHAR,
device_width int,
device_height int,
device_id VARCHAR NOT NULL,
device_lang VARCHAR,
device_model VARCHAR,
device_brand VARCHAR,
device_os VARCHAR,
device_type VARCHAR,
event_name VARCHAR NOT NULL,
event_type VARCHAR,
event_time DATETIME NOT NULL,
net_type VARCHAR,
user_id VARCHAR,
order_id VARCHAR,
amount bigint,
platform VARCHAR,
status int,
servid VARCHAR,
server_name VARCHAR,
role_id VARCHAR,
role_name VARCHAR,
role_level VARCHAR,
job_id VARCHAR,
job_name VARCHAR,
var1 VARCHAR,
var2 VARCHAR,
var3 VARCHAR,
var4 VARCHAR,
var5 VARCHAR,
var6 VARCHAR,
var7 VARCHAR,
var8 VARCHAR,
var9 VARCHAR,
var10 VARCHAR,
var11 VARCHAR,
var12 VARCHAR,
var13 VARCHAR,
var14 VARCHAR,
var15 VARCHAR,
var16 VARCHAR,
var17 VARCHAR,
var18 VARCHAR,
var19 VARCHAR,
var20 VARCHAR,
var21 VARCHAR,
var22 VARCHAR,
var23 VARCHAR,
var24 VARCHAR,
var25 VARCHAR,
var26 VARCHAR,
var27 VARCHAR,
var28 VARCHAR,
var29 VARCHAR,
var30 VARCHAR,
ds date NOT NULL,
prodid VARCHAR,
prod_name VARCHAR,
sub_servid VARCHAR,
sub_server_name VARCHAR
)
ENGINE=OLAP
PARTITION BY RANGE(`ds`) () DISTRIBUTED BY HASH (ds) BUCKETS 32 PROPERTIES
 (
    "min_load_replica_num" = "-1",
  "dynamic_partition.enable" = "true",
  "dynamic_partition.time_unit" = "DAY",
  "dynamic_partition.time_zone" = "Asia/Shanghai",
  "dynamic_partition.start" = "-15",
  "dynamic_partition.end" = "3",
  "dynamic_partition.buckets" = "32",
  "dynamic_partition.create_history_partition" = "true",
  "dynamic_partition.prefix" = "p_",
  "storage_medium" = "hdd"
);


CREATE TABLE ods_risk_detail (
appid int NOT NULL,
channel_id int,
device_id VARCHAR,
game_id int,
servid bigint,
user_id VARCHAR,
role_id VARCHAR,
ip VARCHAR,
location VARCHAR,
env_risk VARCHAR,
plug_risk VARCHAR,
other_risk VARCHAR,
event_time DATETIME NOT NULL
)
DISTRIBUTED BY HASH(`appid`) BUCKETS 32


CREATE TABLE ods_risk_device (
appid int NOT NULL,
device_id VARCHAR NOT NULL,
ds VARCHAR NOT NULL,
channel_id VARCHAR,
game_id int,
servid bigint,
user_id VARCHAR,
role_id VARCHAR,
ip VARCHAR,
location VARCHAR,
env_risk VARCHAR,
plug_risk VARCHAR,
other_risk VARCHAR,
event_time DATETIME NOT NULL
)
UNIQUE KEY (appid, device_id, ds) DISTRIBUTED BY HASH (appid) BUCKETS 32;


drop table ods_rollserv_account_r;
CREATE TABLE ods_rollserv_account_r (
gmid int,
appid int,
app_ver VARCHAR,
sdk_ver VARCHAR,
channel VARCHAR,
country VARCHAR,
province VARCHAR,
city VARCHAR,
isp VARCHAR,
ip VARCHAR,
device_id VARCHAR,
device_model VARCHAR,
device_brand VARCHAR,
device_os VARCHAR,
device_type VARCHAR,
event_time bigint,
user_id VARCHAR,
servid VARCHAR,
role_id VARCHAR,
job_id VARCHAR,
role_level VARCHAR,
role_name VARCHAR,
job_name VARCHAR,
ds date
)
 DISTRIBUTED BY HASH (gmid) BUCKETS 32;


 CREATE TABLE ods_track_log_for_gmweb (
appid bigint NOT NULL,
ds date NOT NULL,
app_id VARCHAR,
app_ver VARCHAR,
sdk_ver VARCHAR,
channel VARCHAR,
country VARCHAR,
province VARCHAR,
city VARCHAR,
isp VARCHAR,
ip VARCHAR,
net_type VARCHAR,
device_width int,
device_height int,
device_id VARCHAR NOT NULL,
device_lang VARCHAR,
device_model VARCHAR,
device_brand VARCHAR,
device_os VARCHAR,
device_type VARCHAR,
event_name VARCHAR NOT NULL,
event_type VARCHAR,
event_time DATETIME NOT NULL,
user_id VARCHAR,
var1 VARCHAR,
var2 VARCHAR,
var3 VARCHAR,
var4 VARCHAR,
var5 VARCHAR,
var6 VARCHAR,
var7 VARCHAR,
var8 VARCHAR,
var9 VARCHAR,
var10 VARCHAR,
var11 VARCHAR,
var12 VARCHAR,
var13 VARCHAR,
var14 VARCHAR,
var15 VARCHAR,
var16 VARCHAR,
var17 VARCHAR,
var18 VARCHAR,
var19 VARCHAR,
var20 VARCHAR,
var21 VARCHAR,
var22 VARCHAR,
var23 VARCHAR,
var24 VARCHAR,
var25 VARCHAR,
var26 VARCHAR,
var27 VARCHAR,
var28 VARCHAR,
var29 VARCHAR,
var30 VARCHAR
)
 DISTRIBUTED BY HASH (appid,ds) BUCKETS 32;