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 2021/03/17 06:09:24 UTC

[GitHub] [incubator-doris] qidaye opened a new pull request #5529: [Feature] add list partition support

qidaye opened a new pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529


   ## Proposed changes
   
   add list partition support 
   
   ## Types of changes
   
   What types of changes does your code introduce to Doris?
   _Put an `x` in the boxes that apply_
   
   - [ ] Bugfix (non-breaking change which fixes an issue)
   - [x] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [x] Documentation Update (if none of the other choices apply)
   - [x] Code refactor (Modify the code structure, format the code, etc...)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._
   
   - [x] I have created an issue on (Fix #5402) and described the bug/feature there in detail
   - [x] Compiling and unit tests pass locally with my changes
   - [x] I have added tests that prove my fix is effective or that my feature works
   - [x] If these changes need document changes, I have updated the document
   - [x] Any dependent changes have been merged
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 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.

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] [incubator-doris] EmmyMiao87 commented on a change in pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on a change in pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#discussion_r595938868



##########
File path: docs/en/getting-started/data-partition.md
##########
@@ -86,6 +88,38 @@ PROPERTIES
     "storage_cooldown_time" = "2018-01-01 12:00:00"
 );
 
+
+-- List Partition
+
+CREATE TABLE IF NOT EXISTS example_db.expamle_list_tbl
+(
+    `user_id` LARGEINT NOT NULL COMMENT "用户id",

Review comment:
       Change it to English.

##########
File path: docs/zh-CN/administrator-guide/load-data/delete-manual.md
##########
@@ -66,7 +66,7 @@ DELETE FROM my_table PARTITION p1 WHERE k1 < 3 AND k2 = "abc";
 2. `Where`语句中的列只能是`key`列
 3.  当选定的`key`列不存在某个rollup表内时,无法进行delete
 4.  条件语句中各个条件只能是`and`关系,如希望达成`or`可将条件分别写入两个delete语句中
-5.  如果指定表为RANGE分区表,则必须指定 `PARTITION`。如果是单分区表,可以不指定。
+5.  如果指定表为RANGE或者LIST分区表,则必须指定 `PARTITION`。如果是单分区表,可以不指定。

Review comment:
       英文词的左右两边可以加上空格,这样好看一些




----------------------------------------------------------------
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.

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] [incubator-doris] qidaye commented on a change in pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
qidaye commented on a change in pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#discussion_r612980792



##########
File path: be/src/exec/tablet_info.cpp
##########
@@ -237,14 +255,27 @@ Status OlapTablePartitionParam::init() {
             }
         }
         _partitions.emplace_back(part);
-        _partitions_map->emplace(part->end_key, part);
+        if (t_part.__isset.in_keys) {
+            for (auto in_key : part->in_keys) {
+                _partitions_map->emplace(in_key, part);
+            }
+        } else {
+            _partitions_map->emplace(part->end_key, part);
+        }
     }
     return Status::OK();
 }
 
 bool OlapTablePartitionParam::find_tablet(Tuple* tuple, const OlapTablePartition** partition,
                                           uint32_t* dist_hashes) const {
-    auto it = _partitions_map->upper_bound(tuple);
+    const TOlapTablePartition& t_part = _t_param.partitions[0];

Review comment:
       Doris creates at least one partition (unpartitioned table) for the olap table, so here `_t_param.partitions.size() ` is at least 1, no need to worry about.




-- 
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.

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] [incubator-doris] qidaye commented on pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
qidaye commented on pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#issuecomment-823333695


   > There is some thing to do with #5667.
   > Better to suppor it after #5667 being merged.
   
   ok, I'll check it.


-- 
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.

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] [incubator-doris] qidaye commented on a change in pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
qidaye commented on a change in pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#discussion_r613024955



##########
File path: docs/zh-CN/administrator-guide/load-data/delete-manual.md
##########
@@ -66,7 +66,7 @@ DELETE FROM my_table PARTITION p1 WHERE k1 < 3 AND k2 = "abc";
 2. `Where`语句中的列只能是`key`列
 3.  当选定的`key`列不存在某个rollup表内时,无法进行delete
 4.  条件语句中各个条件只能是`and`关系,如希望达成`or`可将条件分别写入两个delete语句中
-5.  如果指定表为RANGE分区表,则必须指定 `PARTITION`。如果是单分区表,可以不指定。
+5.  如果指定表为RANGE或者LIST分区表,则必须指定 `PARTITION`。如果是单分区表,可以不指定。

Review comment:
       done




-- 
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.

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] [incubator-doris] morningman merged pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529


   


-- 
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.

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] [incubator-doris] qidaye commented on a change in pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
qidaye commented on a change in pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#discussion_r613024764



##########
File path: be/src/exec/tablet_info.cpp
##########
@@ -237,14 +255,27 @@ Status OlapTablePartitionParam::init() {
             }
         }
         _partitions.emplace_back(part);
-        _partitions_map->emplace(part->end_key, part);
+        if (t_part.__isset.in_keys) {
+            for (auto in_key : part->in_keys) {
+                _partitions_map->emplace(in_key, part);
+            }
+        } else {
+            _partitions_map->emplace(part->end_key, part);
+        }
     }
     return Status::OK();
 }
 
 bool OlapTablePartitionParam::find_tablet(Tuple* tuple, const OlapTablePartition** partition,
                                           uint32_t* dist_hashes) const {
-    auto it = _partitions_map->upper_bound(tuple);
+    const TOlapTablePartition& t_part = _t_param.partitions[0];
+    decltype(_partitions_map->find(tuple)) it;

Review comment:
       done

##########
File path: docs/en/getting-started/data-partition.md
##########
@@ -86,6 +88,38 @@ PROPERTIES
     "storage_cooldown_time" = "2018-01-01 12:00:00"
 );
 
+
+-- List Partition
+
+CREATE TABLE IF NOT EXISTS example_db.expamle_list_tbl
+(
+    `user_id` LARGEINT NOT NULL COMMENT "用户id",

Review comment:
       done




-- 
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.

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] [incubator-doris] stdpain commented on a change in pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
stdpain commented on a change in pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#discussion_r595747838



##########
File path: be/src/exec/tablet_info.cpp
##########
@@ -237,14 +255,27 @@ Status OlapTablePartitionParam::init() {
             }
         }
         _partitions.emplace_back(part);
-        _partitions_map->emplace(part->end_key, part);
+        if (t_part.__isset.in_keys) {
+            for (auto in_key : part->in_keys) {
+                _partitions_map->emplace(in_key, part);
+            }
+        } else {
+            _partitions_map->emplace(part->end_key, part);
+        }
     }
     return Status::OK();
 }
 
 bool OlapTablePartitionParam::find_tablet(Tuple* tuple, const OlapTablePartition** partition,
                                           uint32_t* dist_hashes) const {
-    auto it = _partitions_map->upper_bound(tuple);
+    const TOlapTablePartition& t_part = _t_param.partitions[0];

Review comment:
       check _t_param.partitions.size() ?




----------------------------------------------------------------
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.

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] [incubator-doris] stdpain commented on a change in pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
stdpain commented on a change in pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#discussion_r595746665



##########
File path: be/src/exec/tablet_info.cpp
##########
@@ -237,14 +255,27 @@ Status OlapTablePartitionParam::init() {
             }
         }
         _partitions.emplace_back(part);
-        _partitions_map->emplace(part->end_key, part);
+        if (t_part.__isset.in_keys) {
+            for (auto in_key : part->in_keys) {
+                _partitions_map->emplace(in_key, part);
+            }
+        } else {
+            _partitions_map->emplace(part->end_key, part);
+        }
     }
     return Status::OK();
 }
 
 bool OlapTablePartitionParam::find_tablet(Tuple* tuple, const OlapTablePartition** partition,
                                           uint32_t* dist_hashes) const {
-    auto it = _partitions_map->upper_bound(tuple);
+    const TOlapTablePartition& t_part = _t_param.partitions[0];
+    decltype(_partitions_map->find(tuple)) it;

Review comment:
       we could use std::map<x,x>::iterator instead of this




----------------------------------------------------------------
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.

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] [incubator-doris] morningman edited a comment on pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
morningman edited a comment on pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#issuecomment-823224451


   There is some thing to do with #5667. 
   Better to suppor it after #5667 being merged.


-- 
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.

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] [incubator-doris] qidaye commented on pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
qidaye commented on pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#issuecomment-825375269


   > > There is some thing to do with #5667.
   > > Better to suppor it after #5667 being merged.
   > 
   > ok, I'll check it.
   
   done


-- 
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.

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] [incubator-doris] morningman commented on pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
morningman commented on pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529#issuecomment-823224451


   There is some thing to do with #5667. 


-- 
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.

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] [incubator-doris] morningman merged pull request #5529: [Feature] add list partition support

Posted by GitBox <gi...@apache.org>.
morningman merged pull request #5529:
URL: https://github.com/apache/incubator-doris/pull/5529


   


-- 
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.

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