建表语句:
CREATE TABLE IF NOT EXISTS AukeysDataWarehouse.GP_ListingProfit2
(
SettlementTime
DATE NOT NULL,
AccountId
INT NOT NULL,
SiteID
INT NOT NULL,
Id
INT NOT NULL COMMENT “用户id”,
SellerSku
VARCHAR(60),
ItemId
VARCHAR(20),
ItemName
VARCHAR(1000),
Period
VARCHAR(10),
SalesPlatformID
INT NOT NULL,
Sku
VARCHAR(30),
SalesPrice
DECIMAL(18, 6),
DiscountPrice
DECIMAL(18, 6),
NetSalesPrice
DECIMAL(18, 6),
SalesQty
INT,
PurchaseAmt
DECIMAL(18, 6),
FirstShipAmt
DECIMAL(18, 6),
TransferAmt
DECIMAL(18, 6),
FBAStorageAmt
DECIMAL(18, 6),
OverseaStorageAmt
DECIMAL(18, 6),
RefundAmt
DECIMAL(18, 6),
ShipAmt
DECIMAL(18, 6),
CommissionAmt
DECIMAL(18, 6),
TaxAmt
DECIMAL(18, 6),
LDAmt
DECIMAL(18, 6),
CPCAmt
DECIMAL(18, 6),
FBAReimbursedAmt
DECIMAL(18, 6),
GrossProfit
DECIMAL(18, 6),
UpdateTime
DATETIME,
BudgetType
INT,
SalesUserName
VARCHAR(10),
DevelopUserName
VARCHAR(10),
ShopName
VARCHAR(30),
ShopId
INT,
TwoLevelTeamId
INT,
FBARemovalPurchaseAmt
DECIMAL(18, 6),
FBARemovalFirstShipAmt
DECIMAL(18, 6),
FBARemovalFeeAmt
DECIMAL(18, 6)
)
PRIMARY KEY(SettlementTime
,AccountId
,SiteID
,Id
)
PARTITION BY date_trunc(‘month’, SettlementTime)
DISTRIBUTED BY HASH(AccountId
)
PROPERTIES (
“replication_num” = “3”,
“enable_persistent_index” = “true”
);