-- base表ddl:
drop table if exists web_sales force;
CREATE TABLE IF NOT EXISTS web_sales (
ws_item_sk bigint not null,
ws_order_number bigint not null,
ws_sold_date_sk bigint,
ws_sold_time_sk bigint,
ws_ship_date_sk bigint,
ws_bill_customer_sk bigint,
ws_bill_cdemo_sk bigint,
ws_bill_hdemo_sk bigint,
ws_bill_addr_sk bigint,
ws_ship_customer_sk bigint,
ws_ship_cdemo_sk bigint,
ws_ship_hdemo_sk bigint,
ws_ship_addr_sk bigint,
ws_web_page_sk bigint,
ws_web_site_sk bigint,
ws_ship_mode_sk bigint,
ws_warehouse_sk bigint,
ws_promo_sk bigint,
ws_quantity integer,
ws_wholesale_cost decimalv3(7,2),
ws_list_price decimalv3(7,2),
ws_sales_price decimalv3(7,2),
ws_ext_discount_amt decimalv3(7,2),
ws_ext_sales_price decimalv3(7,2),
ws_ext_wholesale_cost decimalv3(7,2),
ws_ext_list_price decimalv3(7,2),
ws_ext_tax decimalv3(7,2),
ws_coupon_amt decimalv3(7,2),
ws_ext_ship_cost decimalv3(7,2),
ws_net_paid decimalv3(7,2),
ws_net_paid_inc_tax decimalv3(7,2),
ws_net_paid_inc_ship decimalv3(7,2),
ws_net_paid_inc_ship_tax decimalv3(7,2),
ws_net_profit decimalv3(7,2)
)
DUPLICATE KEY(ws_item_sk, ws_order_number)
PARTITION BY RANGE(ws_sold_date_sk)
(
PARTITION `p1` VALUES LESS THAN ("2450846"),
PARTITION `p2` VALUES LESS THAN ("2450874"),
PARTITION `p3` VALUES LESS THAN ("2450905"),
PARTITION `p4` VALUES LESS THAN ("2450935"),
PARTITION `p5` VALUES LESS THAN ("2450966"),
PARTITION `p6` VALUES LESS THAN ("2450996"),
PARTITION `p7` VALUES LESS THAN ("2451027"),
PARTITION `p8` VALUES LESS THAN ("2451058"),
PARTITION `p9` VALUES LESS THAN ("2451088"),
PARTITION `p10` VALUES LESS THAN (MAXVALUE)
)
DISTRIBUTED BY HASH(ws_item_sk, ws_order_number) BUCKETS 64
PROPERTIES (
"replication_num" = "3",
"colocate_with" = "web-3"
);