forked from apache/doris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat](nereids) support partition level column stats (apache#35875)
## Proposed changes now partition level column stats are collected. StatsDrive job will merge the partition level col stats as single column stats, and then use the merged col stats for stats deriviation, instead of using the table level column stats. Issue Number: close #xxx <!--Describe your changes.-->
- Loading branch information
Showing
3 changed files
with
139 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
regression-test/suites/nereids_p0/stats/partition_col_stats.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Licensed to the Apache Software Foundation (ASF) under one | ||
// or more contributor license agreements. See the NOTICE file | ||
// distributed with this work for additional information | ||
// regarding copyright ownership. The ASF licenses this file | ||
// to you under the Apache License, Version 2.0 (the | ||
// "License"); you may not use this file except in compliance | ||
// with the License. You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, | ||
// software distributed under the License is distributed on an | ||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
// KIND, either express or implied. See the License for the | ||
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
suite("partition_col_stats") { | ||
multi_sql """ | ||
set global enable_partition_analyze=true; | ||
drop table if exists pt; | ||
CREATE TABLE `pt` ( | ||
`k1` int(11) NULL COMMENT "", | ||
`k2` int(11) NULL COMMENT "", | ||
`k3` int(11) NULL COMMENT "" | ||
) | ||
PARTITION BY RANGE(`k1`) | ||
(PARTITION p1 VALUES LESS THAN ("3"), | ||
PARTITION p2 VALUES [("3"), ("7")), | ||
PARTITION p3 VALUES [("7"), ("10"))) | ||
DISTRIBUTED BY HASH(`k1`) BUCKETS 10 | ||
PROPERTIES ('replication_num' = '1'); | ||
insert into pt values (1, 2, 2), (1, 3, 3), (1, 4, 1), (1, 4, 1), (4, 4, 4), (5,5,5),(6,6,6); | ||
analyze table pt with sync; | ||
""" | ||
//run this sql to make stats be cached | ||
sql "select * from pt where k1<3;" | ||
sleep(10) | ||
explain{ | ||
sql "physical plan select * from pt where k1<3;" | ||
contains("stats=4") | ||
} | ||
|
||
} |