-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
1,
CREATE TABLE lineorders (
orderdate varchar(100) NOT NULL,
orderid int NOT NULL,
country_id int NOT NULL,
vender_id int NOT NULL,
ordernum int NOT NULL,
ordemoney int NOT NULL
) ENGINE=OLAP
DUPLICATE KEY(orderdate, orderid, country_id)
COMMENT 'OLAP'
PARTITION BY LIST(orderdate)
(PARTITION p1992 VALUES IN ("0-2020"),
PARTITION p1993 VALUES IN ("0-2021"),
PARTITION p1994 VALUES IN ("0-2022"),
PARTITION p1995 VALUES IN ("0-2023"),
PARTITION p1996 VALUES IN ("0-2024"),
PARTITION p1997 VALUES IN ("0-2025"))
DISTRIBUTED BY HASH(orderid) BUCKETS 48
PROPERTIES (
"replication_allocation" = "tag.location.default: 3",
"min_load_replica_num" = "-1",
"is_being_synced" = "false",
"storage_medium" = "hdd",
"storage_format" = "V2",
"inverted_index_storage_format" = "V2",
"light_schema_change" = "true",
"disable_auto_compaction" = "false",
"enable_single_replica_compaction" = "false",
"group_commit_interval_ms" = "10000",
"group_commit_data_bytes" = "134217728"
);
2,
explain select * from ( select orderid,orderdate,country_id,ordernum, ordemoney, SUBSTR(lineorders.orderdate,3,4) AS dt, ROW_NUMBER() OVER(PARTITION BY lineorders.orderid,lineorders.orderdate ORDER BYlineorders.country_id DESC) AS rn from lineorders) a where SUBSTR(a.dt, 1, 4) = SUBSTR(curdate(), 1, 4);
3, will get explain string like following
| 0:VOlapScanNode(169) |
| TABLE: t.lineorders(lineorders), PREAGGREGATION: ON |
| partitions=6/6 (p1992,p1993,p1994,p1995,p1996,p1997) |
| tablets=288/288, tabletList=1011601,1011605,1011609 ... |
| cardinality=6, avgRowSize=0.0, numNodes=1 |
| pushAggOp=NONE |
| final projections: orderid[https://github.com//issues/1], orderdate[#0], country_id[https://github.com//issues/2], ordernum[https://github.com//issues/4], ordemoney[https://github.com//issues/5], substring(orderdate[#0], 3, 4) |
| final project output tuple id: 1 |
+---------------------------------------------------------------------------------------------------------------------------------+