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) adjust stats derive by delta row (apache#39222)
## Proposed changes After analyzing, user may insert new rows. analyzed rows: the rows have been analyzed delta row: rows inserted after analyze job if analyzed rows are filtered out, then we try to estimate filter result by delta row with unknown column stats. Issue Number: close #xxx <!--Describe your changes.-->
- Loading branch information
Showing
7 changed files
with
143 additions
and
53 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
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
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
55 changes: 55 additions & 0 deletions
55
regression-test/suites/nereids_p0/delta_row/delta_row.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,55 @@ | ||
// 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("delta_row") { | ||
String database = context.config.getDbNameByFile(context.file) | ||
sql """ | ||
drop database if exists ${database}; | ||
create database ${database}; | ||
use ${database}; | ||
CREATE TABLE IF NOT EXISTS t ( | ||
k int(11) null comment "", | ||
v string replace null comment "", | ||
) engine=olap | ||
DISTRIBUTED BY HASH(k) BUCKETS 5 properties("replication_num" = "1"); | ||
insert into t values (1, "a"),(2, "b"),(3, 'c'),(4,'d'); | ||
analyze table t with sync; | ||
""" | ||
explain { | ||
sql "physical plan select * from t where k > 6" | ||
contains("stats=0,") | ||
contains("stats=4 ") | ||
// PhysicalResultSink[75] ( outputExprs=[k#0, v#1] ) | ||
// +--PhysicalFilter[72]@1 ( stats=0, predicates=(k#0 > 6) ) | ||
// +--PhysicalOlapScan[t]@0 ( stats=4 ) | ||
} | ||
|
||
sql "set global enable_auto_analyze=false;" | ||
|
||
sql "insert into t values (10, 'c');" | ||
explain { | ||
sql "physical plan select * from t where k > 6" | ||
contains("stats=0.5,") | ||
contains("stats=5(1)") | ||
notContains("stats=0,") | ||
notContains("stats=4 ") | ||
// PhysicalResultSink[75] ( outputExprs=[k#0, v#1] ) | ||
// +--PhysicalFilter[72]@1 ( stats=0.5, predicates=(k#0 > 6) ) | ||
// +--PhysicalOlapScan[t]@0 ( stats=5(1) ) | ||
} | ||
} |