You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/07/13 11:21:45 UTC

[GitHub] [doris] yiguolei opened a new pull request, #10816: [refactor] some refactor of delete predicates

yiguolei opened a new pull request, #10816:
URL: https://github.com/apache/doris/pull/10816

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem Summary:
   
   Describe the overview of changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: (Yes/No/I Don't know)
   2. Has unit tests been added: (Yes/No/No Need)
   3. Has document been added or modified: (Yes/No/No Need)
   4. Does it need to update dependencies: (Yes/No)
   5. Are there any changes that cannot be rolled back: (Yes/No)
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] wangbo commented on a diff in pull request #10816: [refactor] some refactor of delete predicates

Posted by GitBox <gi...@apache.org>.
wangbo commented on code in PR #10816:
URL: https://github.com/apache/doris/pull/10816#discussion_r920941171


##########
be/src/olap/tablet_meta.cpp:
##########
@@ -673,48 +673,42 @@ RowsetMetaSharedPtr TabletMeta::acquire_stale_rs_meta_by_version(const Version&
 }
 
 void TabletMeta::add_delete_predicate(const DeletePredicatePB& delete_predicate, int64_t version) {
-    for (auto& del_pred : _del_pred_array) {
+    for (auto& del_pred : _del_predicates) {
         if (del_pred.version() == version) {
             *del_pred.mutable_sub_predicates() = delete_predicate.sub_predicates();
             return;
         }
     }
-    DeletePredicatePB* del_pred = _del_pred_array.Add();
-    del_pred->set_version(version);
-    *del_pred->mutable_sub_predicates() = delete_predicate.sub_predicates();
-    *del_pred->mutable_in_predicates() = delete_predicate.in_predicates();
+    DeletePredicatePB copied_pred = delete_predicate;
+    copied_pred.set_version(version);
+    _del_predicates.emplace_back(copied_pred);
 }
 
 void TabletMeta::remove_delete_predicate_by_version(const Version& version) {
     DCHECK(version.first == version.second) << "version=" << version;
-    for (int ordinal = 0; ordinal < _del_pred_array.size(); ++ordinal) {
-        const DeletePredicatePB& temp = _del_pred_array.Get(ordinal);
-        if (temp.version() == version.first) {
-            // log delete condition
-            string del_cond_str;
-            for (const auto& it : temp.sub_predicates()) {
-                del_cond_str += it + ";";
-            }
-            VLOG_NOTICE << "remove one del_pred. version=" << temp.version()
-                        << ", condition=" << del_cond_str;
-
-            // remove delete condition from PB
-            _del_pred_array.SwapElements(ordinal, _del_pred_array.size() - 1);
-            _del_pred_array.RemoveLast();
+    int pred_to_del = -1;
+    for (int i = 0; i < _del_predicates.size(); ++i) {
+        if (_del_predicates[i].version() == version.first) {
+            pred_to_del = i;
+            // add_delete_predicate already make sure there is only one predicate for specific version

Review Comment:
   ```suggestion
               // one DeletePredicatePB stands for a nested predicate, such as user submit a delete predicate a=1 and b=2
          //  they could be saved as a one DeletePredicatePB
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yiguolei merged pull request #10816: [refactor] some refactor of delete predicates

Posted by GitBox <gi...@apache.org>.
yiguolei merged PR #10816:
URL: https://github.com/apache/doris/pull/10816


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org