This is an automated email from the ASF dual-hosted git repository.
xuyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 9155d8b9d1 [fix](delete) fix 'is null' or 'is not null' delete
predicate will get wrong result (#17190)
9155d8b9d1 is described below
commit 9155d8b9d190107f5e843420c5d0661bacfa4213
Author: xueweizhang <[email protected]>
AuthorDate: Thu Mar 2 14:05:44 2023 +0800
[fix](delete) fix 'is null' or 'is not null' delete predicate will get
wrong result (#17190)
fix 'is null' or 'is not null' delete predicate will get wrong result
Signed-off-by: nextdreamblue <[email protected]>
---
be/src/olap/null_predicate.h | 7 +-
.../data/delete_p0/test_zone_map_delete.out | 104 +++++++++++++++++++++
.../suites/delete_p0/test_zone_map_delete.groovy | 23 +++++
3 files changed, 132 insertions(+), 2 deletions(-)
diff --git a/be/src/olap/null_predicate.h b/be/src/olap/null_predicate.h
index 73d6bb32bf..7424548054 100644
--- a/be/src/olap/null_predicate.h
+++ b/be/src/olap/null_predicate.h
@@ -54,10 +54,13 @@ public:
}
bool evaluate_del(const std::pair<WrapperField*, WrapperField*>&
statistic) const override {
+ // evaluate_del only use for delete condition to filter page, need use
delete condition origin value,
+ // when opposite==true, origin value 'is null'->'is not null' and 'is
not null'->'is null',
+ // so when _is_null==true, need check 'is not null' and
_is_null==false, need check 'is null'
if (_is_null) {
- return statistic.first->is_null() && statistic.second->is_null();
- } else {
return !statistic.first->is_null() && !statistic.second->is_null();
+ } else {
+ return statistic.first->is_null() && statistic.second->is_null();
}
}
diff --git a/regression-test/data/delete_p0/test_zone_map_delete.out
b/regression-test/data/delete_p0/test_zone_map_delete.out
index ba300220f4..d4867dc17e 100644
--- a/regression-test/data/delete_p0/test_zone_map_delete.out
+++ b/regression-test/data/delete_p0/test_zone_map_delete.out
@@ -343,3 +343,107 @@
-- !sql --
1 11
+-- !sql --
+1 11
+1 22
+1 33
+1 44
+1 55
+1 66
+1 77
+1 88
+1 99
+1 100
+1 101
+1 102
+1 111
+1 122
+1 133
+1 144
+1 155
+1 166
+1 177
+1 188
+1 199
+1 200
+1 201
+1 202
+
+-- !sql --
+1 11
+1 22
+1 33
+1 44
+1 55
+1 66
+1 77
+1 88
+1 99
+1 100
+1 101
+1 102
+1 111
+1 122
+1 133
+1 144
+1 155
+1 166
+1 177
+1 188
+1 199
+1 200
+1 201
+1 202
+
+-- !sql --
+\N 11
+\N 22
+\N 33
+\N 44
+\N 55
+\N 66
+\N 77
+\N 88
+\N 99
+\N 100
+\N 101
+\N 102
+\N 111
+\N 122
+\N 133
+\N 144
+\N 155
+\N 166
+\N 177
+\N 188
+\N 199
+\N 200
+\N 201
+\N 202
+
+-- !sql --
+\N 11
+\N 22
+\N 33
+\N 44
+\N 55
+\N 66
+\N 77
+\N 88
+\N 99
+\N 100
+\N 101
+\N 102
+\N 111
+\N 122
+\N 133
+\N 144
+\N 155
+\N 166
+\N 177
+\N 188
+\N 199
+\N 200
+\N 201
+\N 202
+
diff --git a/regression-test/suites/delete_p0/test_zone_map_delete.groovy
b/regression-test/suites/delete_p0/test_zone_map_delete.groovy
index f79830c815..0aaf868ee3 100644
--- a/regression-test/suites/delete_p0/test_zone_map_delete.groovy
+++ b/regression-test/suites/delete_p0/test_zone_map_delete.groovy
@@ -149,6 +149,29 @@ suite("test_zone_map_delete") {
qt_sql """select k2,k3 from ${tableName} where k3 = 11 ORDER BY k3;"""
+
+ sql """truncate table ${tableName};"""
+
+ sql """insert into ${tableName}
values(0,1,11),(0,1,22),(0,1,33),(0,1,44),(0,1,55),(0,1,66),(0,1,77),(0,1,88),(0,1,99),(0,1,100),(0,1,101),(0,1,102),(0,1,111),(0,1,122),(0,1,133),(0,1,144),(0,1,155),(0,1,166),(0,1,177),(0,1,188),(0,1,199),(0,1,200),(0,1,201),(0,1,202);"""
+
+ sql """delete from ${tableName} where k2 is null;"""
+
+ qt_sql """select k2,k3 from ${tableName} ORDER BY k3;"""
+
+ qt_sql """select k2,k3 from ${tableName} where k2 is not null ORDER BY
k3;"""
+
+
+ sql """truncate table ${tableName};"""
+
+ sql """insert into ${tableName}
values(0,null,11),(0,null,22),(0,null,33),(0,null,44),(0,null,55),(0,null,66),(0,null,77),(0,null,88),(0,null,99),(0,null,100),(0,null,101),(0,null,102),(0,null,111),(0,null,122),(0,null,133),(0,null,144),(0,null,155),(0,null,166),(0,null,177),(0,null,188),(0,null,199),(0,null,200),(0,null,201),(0,null,202);"""
+
+ sql """delete from ${tableName} where k2 is not null;"""
+
+ qt_sql """select k2,k3 from ${tableName} ORDER BY k3;"""
+
+ qt_sql """select k2,k3 from ${tableName} where k2 is null ORDER BY k3;"""
+
+
sql """ DROP TABLE IF EXISTS ${tableName} """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]