Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions be/src/olap/null_predicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ class NullPredicate : public ColumnPredicate {
}

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',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to check if opposite==false ?

Copy link
Contributor Author

@nextdreamblue nextdreamblue Mar 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only deletehandler set opposite=true and evaluate_del only use for delete condition to filter page.
when opposite==false, evaluate_del will not be used to filter page.

// 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();
}
}

Expand Down
104 changes: 104 additions & 0 deletions regression-test/data/delete_p0/test_zone_map_delete.out
Original file line number Diff line number Diff line change
Expand Up @@ -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

23 changes: 23 additions & 0 deletions regression-test/suites/delete_p0/test_zone_map_delete.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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} """

}