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 37
| CREATE TABLE dwd.`dwd_cdc_t_fin_trade_record_detail` ( `trade_id` varchar(200) NULL COMMENT "流水号", `merchant_code` varchar(200) NOT NULL COMMENT "", `order_no_business` varchar(800) NULL COMMENT "订单业务字段(包材费时存包材号,仓储费时存批次号,操作费存冻结记录id)", `trade_date` date NULL COMMENT "变动时间", `trade_type` int(11) NULL COMMENT "交易类型,1-线下充值,2-操作费,3-仓储费,4-包材,5调账,6线上充值,7贴标服务费,8-退仓存储费", `cost_name` varchar(200) NULL COMMENT "费用名称", `merchant_name` varchar(400) NULL COMMENT "卖家名称", `source` varchar(200) NULL COMMENT "来源", `trade_amount` decimal(20, 2) NULL COMMENT "变动金额(充值未正,扣费为负)", `currency_code` varchar(40) NULL COMMENT "", `packing_material_name` varchar(1020) NOT NULL COMMENT "包材名称", `is_active` int(11) NULL COMMENT "数据是否已被逻辑删除,0是已删除,1是未删除", `etl_time` datetime NULL COMMENT "跑批日期" ) ENGINE=OLAP DUPLICATE KEY(`trade_id`,`merchant_code`) COMMENT "商户余额变动流水表" PARTITION BY RANGE(`trade_date`)() DISTRIBUTED BY HASH(`merchant_code`) BUCKETS 3 PROPERTIES ( "replication_allocation" = "tag.location.default: 3", "dynamic_partition.enable" = "true", "dynamic_partition.time_unit" = "MONTH", "dynamic_partition.time_zone" = "Asia/Shanghai", "dynamic_partition.start" = "-2147483648", "dynamic_partition.end" = "2", "dynamic_partition.prefix" = "p", "dynamic_partition.replication_allocation" = "tag.location.default: 3", "dynamic_partition.buckets" = "4", "dynamic_partition.create_history_partition" = "true", "dynamic_partition.history_partition_num" = "24", "dynamic_partition.hot_partition_num" = "0", "dynamic_partition.reserved_history_periods" = "NULL", "dynamic_partition.start_day_of_month" = "1", "in_memory" = "false", "storage_format" = "V2" )
|