Commit 2cc41bbf by WangJinfeng

update clickhouse.sql

parent 30f76130
......@@ -142,6 +142,36 @@ CREATE TABLE dmp.youku_laxin_daily ON CLUSTER cluster_1st (`dt` Date, `device_ty
CREATE TABLE dwh.audience_merge (dt Date,hour FixedString(2),devid String,audience_id Array(Int32)) ENGINE = MergeTree() PARTITION BY (toYYYYMMDD(dt),hour) ORDER BY (dt, hour, devid) SETTINGS index_granularity = 8192;
CREATE TABLE dwh.ods_user_info ON CLUSTER cluster_1st (`dt` Date, `device_id` String, `platform` String, `device_model` String, `os_version` String, `country` String, `age` Int32, `gender` Int32, `install_apps` Array(Int32), `interest` Array(String), `behavior` String, `frequency` String, `tag_week` String, `tag_month` String, `region` Array(String), `update_date` String, `publish_date` String) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/ods_user_info', '{replica}') PARTITION BY toYYYYMMDD(dt) ORDER BY (dt, platform, country, age, gender, update_date) SETTINGS index_granularity = 8192, use_minimalistic_part_header_in_zookeeper = 1;
CREATE TABLE dataplatform_job_meta.yarn_application_metric ON CLUSTER cluster_1st (`application_time` UInt64,`master_name` String,`master_address` String,`user_name` String,`queue_name` String,`application_id` UInt64,`application_name` String,`application_type` String,`application_status` String,`application_core` Int32,`application_memory` Float32,`application_start_time` String,`application_stop_time` String,`application_elapsed_time` String,`application_read_byte` String,`application_write_byte` String,`application_input_path` String,`application_output_path` String,`email` String,`direct_leader` String,`department` String) ENGINE = ReplicatedReplacingMergeTree('/clickhouse/tables/12c9fb56-db0d-4bc6-9aea-0b722551f983/{shard}', '{replica}', application_id) PARTITION BY toYYYYMMDD(toDate(application_time / 1000)) ORDER BY (application_time, master_name, queue_name, user_name, application_id) SETTINGS index_granularity = 8192, use_minimalistic_part_header_in_zookeeper = 1;
CREATE TABLE dataplatform_job_meta.yarn_application_msg ON CLUSTER cluster_1st (`application_time` UInt64,`master_name` String,`master_address` String,`user_name` String,`queue_name` String,`application_id` String,`application_name` String,`application_type` String,`application_status` String,`application_core` UInt64,`application_memory` Float32,`application_start_time` UInt64,`application_stop_time` UInt64,`application_elapsed_time` UInt64,`application_read_byte` UInt64,`application_write_byte` UInt64,`application_input_path` String,`application_output_path` String,`email` String,`direct_leader` String,`department` String) ENGINE = MySQL('ambari-cluster.c5yzcdreb1xr.us-east-1.rds.amazonaws.com:3306', 'dataplatform_job_meta', 'yarn_application_msg', 'dataplatform', 'CNV6tQBb2Mb64Hv');
DROP TABLE dwh.joypac_daily ON CLUSTER cluster_1st;
CREATE TABLE dwh.joypac_daily ON CLUSTER cluster_1st (`dt` Date,`device_id` String)ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/joypac_daily', '{replica}') PARTITION BY toYYYYMMDD(dt) ORDER BY (dt, device_id) SETTINGS index_granularity = 8192, use_minimalistic_part_header_in_zookeeper = 1;
DROP TABLE dwh.sss_tracking_daily ON CLUSTER cluster_1st;
CREATE TABLE dwh.sss_tracking_daily ON CLUSTER cluster_1st (`dt` Date,`device_id` String,`device_model` String,`os_version` String,`country` String,`city` String,`offer_id` Array(String),`event_name` Array(String),`event_type` Array(String),`log_type` Int32)ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/sss_tracking_daily', '{replica}') PARTITION BY toYYYYMMDD(dt) ORDER BY (dt, device_id, log_type) SETTINGS index_granularity = 8192, use_minimalistic_part_header_in_zookeeper = 1;
DROP TABLE dwh.sss_tracking_insight_daily;
CREATE TABLE dwh.sss_tracking_insight_daily (`dt` Date,`device_id` String,`device_model` String,`os_version` String,`country` String,`city` String,`age` Int32,`gender` Int32,`install_apps` Array(Int32),`interest` Array(String),`offer_id` Array(String),`event_name` Array(String),`event_type` Array(String),`log_type` Int32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/sss_tracking_insight_daily', '{replica}') PARTITION BY toYYYYMMDD(dt) ORDER BY (dt, device_id, log_type) TTL dt + toIntervalYear(1) SETTINGS index_granularity = 8192, use_minimalistic_part_header_in_zookeeper = 1;
DROP TABLE dwh.adn_tracking_daily ON CLUSTER cluster_1st;
CREATE TABLE dwh.adn_tracking_daily ON CLUSTER cluster_1st (`dt` Date,`device_id` String,`device_model` String,`os_version` String,`country` String,`city` String,`campaign_id` Array(String),`event_name` Array(String),`event_type` Array(String),`app_id` Array(String),`log_type` Int32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/adn_tracking_daily', '{replica}') PARTITION BY toYYYYMMDD(dt) ORDER BY (dt, device_id, event_type, log_type) TTL dt + toIntervalWeek(1) SETTINGS index_granularity = 8192, use_minimalistic_part_header_in_zookeeper = 1;
DROP TABLE dwh.adn_tracking_insight_daily;
CREATE TABLE dwh.adn_tracking_insight_daily (`dt` Date,`device_id` String,`device_model` String,`os_version` String,`country` String,`city` String,`age` Int32,`gender` Int32,`install_apps` Array(Int32),`interest` Array(String),`campaign_id` Array(String),`event_name` Array(String),`event_type` Array(String),`app_id` Array(String),`log_type` Int32) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/adn_tracking_insight_daily', '{replica}') PARTITION BY toYYYYMMDD(dt) ORDER BY (dt, device_id, event_type, log_type) TTL dt + toIntervalYear(1) SETTINGS index_granularity = 8192, use_minimalistic_part_header_in_zookeeper = 1;
DROP TABLE dwh.joypac_insight_daily;
CREATE TABLE dwh.joypac_insight_daily (`dt` Date, `device_id` String, `country` String, `age` Int32, `gender` Int32, `install_apps` Array(Int32), `interest` Array(String)) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/joypac_insight_daily', '{replica}') PARTITION BY toYYYYMMDD(dt) ORDER BY (dt, country, age, gender) SETTINGS index_granularity = 8192;
CREATE TABLE dmp.uc_lahuo_daily ON CLUSTER cluster_1st(dt Date,device_type String,device_ids String) ENGINE = ReplicatedMergeTree('/clickhouse/tables/{layer}-{shard}/uc_lahuo_daily', '{replica}') PARTITION BY (toYYYYMMDD(dt),device_type) ORDER BY (dt,device_type,device_ids) TTL dt + toIntervalWeek(1) SETTINGS index_granularity = 8192;
CREATE TABLE dmp.uc_lahuo_daily_all ON CLUSTER cluster_1st(dt Date,device_type String,device_ids String) ENGINE = Distributed(cluster_1st, dmp, uc_lahuo_daily, rand());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment