test:
show partitions
建表语句:
CREATE TABLE
order_master_mv_temp
(
report_date
date NOT NULL DEFAULT “20000101” COMMENT “报表统计日期”,
shop_id
bigint(20) NOT NULL COMMENT “店铺ID”,
order_status
tinyint(4) NOT NULL COMMENT “订单状态 10:存单 20:已落单 40:已结账 30:废单”,
order_sub_type
tinyint(4) NOT NULL COMMENT “订单类型(0:堂食 20:外卖 21:自提)”,
channel_key
varchar(150) NOT NULL COMMENT “渠道Key”,
channel_name
varchar(300) NOT NULL COMMENT “订单来源渠道名称”,
cnt
bigint(20) NULL COMMENT “数量”,
year_month_str
varchar(32) NULL COMMENT “年月yyyy-mm”,
food_amount_sum
decimal(15, 2) NULL COMMENT “流水合计”,
paid_amount_sum
decimal(15, 2) NULL COMMENT “实收合计”,
valid_order_count
bigint(20) NULL COMMENT “有效订单数”,
member_food_amount_sum
decimal(15, 2) NULL COMMENT “有效手机号码对应的流水合计”,
member_paid_amount_sum
decimal(15, 2) NULL COMMENT “有效手机号码对应的实收合计”,
member_valid_order_bitmap
bitmap NULL COMMENT “有效订单并且是有效手机号的会员bitmap”,
member_valid_order_count
bigint(20) NULL COMMENT “有效订单并且是有效手机号的订单数”,
deliver_real_amount_sum
decimal(15, 2) NULL COMMENT “配送费实收”,
deliver_promotion_amount_sum
decimal(15, 2) NULL COMMENT “配送费优惠”
) ENGINE=OLAP
PRIMARY KEY(
report_date
,
shop_id
,
order_status
,
order_sub_type
,
channel_key
,
channel_name
)
COMMENT “order_master_mv”
PARTITION BY date_trunc(‘day’, report_date)
DISTRIBUTED BY HASH(
shop_id
) BUCKETS 1
PROPERTIES (
“replication_num” = “1”,
“datacache.enable” = “true”,
“storage_volume” = “builtin_storage_volume”,
“enable_async_write_back” = “false”,
“enable_persistent_index” = “true”,
“persistent_index_type” = “LOCAL”,
“compression” = “LZ4”
);