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/12/28 12:52:48 UTC

[GitHub] [incubator-doris] GoGoWen opened a new pull request #7515: optimization reading for single rowset

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


   ## Proposed changes
   
   this pr try to find a collect fix as  #7427.   the wrong fix is #7351.
   
   Describe the overview of changes, and introduce why we need it.
   
   ## 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)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
   - [ ] Documentation Update (if none of the other choices apply)
   - [ ] Code refactor (Modify the code structure, format the code, etc...)
   - [ X] Optimization. Including functional usability improvements and performance improvements.
   - [ ] Dependency. Such as changes related to third-party components.
   - [ ] Other.
   
   ## 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._
   
   - [ ] I have created an issue on (Fix #ISSUE) and described the bug/feature there in detail
   - [ ] Compiling and unit tests pass locally with my changes
   - [ ] I have added tests that prove my fix is effective or that my feature works
   - [ ] If these changes need document changes, I have updated the document
   - [ ] 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.

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] [incubator-doris] jackwener commented on a change in pull request #7515: optimization reading for single rowset

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



##########
File path: be/src/olap/tuple_reader.cpp
##########
@@ -80,8 +80,15 @@ OLAPStatus TupleReader::init(const ReaderParams& read_params) {
     if (status != OLAP_SUCCESS) { return status; }
 
     if (_optimize_for_single_rowset(rs_readers)) {
-        _next_row_func = _tablet->keys_type() == AGG_KEYS ? &TupleReader::_direct_agg_key_next_row
-                                                          : &TupleReader::_direct_next_row;
+        if (_tablet->keys_type() == AGG_KEYS) {
+            if (_aggregation) {
+                _next_row_func = &Reader::_agg_key_next_row;

Review comment:
       ```suggestion
                   _next_row_func = &TupleReader::_agg_key_next_row;
   ```

##########
File path: be/src/olap/tuple_reader.cpp
##########
@@ -80,8 +80,15 @@ OLAPStatus TupleReader::init(const ReaderParams& read_params) {
     if (status != OLAP_SUCCESS) { return status; }
 
     if (_optimize_for_single_rowset(rs_readers)) {
-        _next_row_func = _tablet->keys_type() == AGG_KEYS ? &TupleReader::_direct_agg_key_next_row
-                                                          : &TupleReader::_direct_next_row;
+        if (_tablet->keys_type() == AGG_KEYS) {
+            if (_aggregation) {
+                _next_row_func = &Reader::_agg_key_next_row;
+            } else {
+                _next_row_func = &Reader::_direct_agg_key_next_row;
+            }
+        } else {
+            _next_row_func = &Reader::_direct_next_row;

Review comment:
       ```suggestion
               _next_row_func = &TupleReader::_direct_next_row;
   ```

##########
File path: be/src/olap/tuple_reader.cpp
##########
@@ -80,8 +80,15 @@ OLAPStatus TupleReader::init(const ReaderParams& read_params) {
     if (status != OLAP_SUCCESS) { return status; }
 
     if (_optimize_for_single_rowset(rs_readers)) {
-        _next_row_func = _tablet->keys_type() == AGG_KEYS ? &TupleReader::_direct_agg_key_next_row
-                                                          : &TupleReader::_direct_next_row;
+        if (_tablet->keys_type() == AGG_KEYS) {
+            if (_aggregation) {
+                _next_row_func = &Reader::_agg_key_next_row;
+            } else {
+                _next_row_func = &Reader::_direct_agg_key_next_row;

Review comment:
       ```suggestion
                   _next_row_func = &TupleReader::_direct_agg_key_next_row;
   ```




-- 
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] [incubator-doris] morningman commented on pull request #7515: optimization reading for single rowset

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


   Hi, @GoGoWen , Sorry for the late reply, I've rethought the question.
   
   Essentially, the purpose of the `_aggregation` parameter is to force the storage layer to return data according to the **aggregation semantics of the table itself** when the **aggregation semantics in the original SQL** do not match the **aggregation semantics of the table itself**.
   
   In the case of single rowset, we can use `_direct_agg_key_next_row` to return the data directly because we can confirm that the data has been aggregated according to the table's own aggregation semantics.
   
   The optimization you want to do is to use the aggregation function at the storage layer to reduce the amount of data returned from the storage layer in the single rowset case. But in essence, the amount of computation is the same when aggregation is done at the storage layer and aggregation is done at the query layer (there is no network overhead, it's all done locally within the same process).
   
   And the parameter `_aggregation` is used to determine whether to optimize or not. However, the `_aggregation` parameter is not essentially used for this purpose, which may make the code less readable.
   
   So have you come across a specific case and found that optimizing this way can significantly improve the efficiency of the query?


-- 
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] [incubator-doris] jackwener commented on a change in pull request #7515: optimization reading for single rowset

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



##########
File path: be/src/olap/tuple_reader.cpp
##########
@@ -80,8 +80,15 @@ OLAPStatus TupleReader::init(const ReaderParams& read_params) {
     if (status != OLAP_SUCCESS) { return status; }
 
     if (_optimize_for_single_rowset(rs_readers)) {
-        _next_row_func = _tablet->keys_type() == AGG_KEYS ? &TupleReader::_direct_agg_key_next_row
-                                                          : &TupleReader::_direct_next_row;
+        if (_tablet->keys_type() == AGG_KEYS) {
+            if (_aggregation) {
+                _next_row_func = &Reader::_agg_key_next_row;

Review comment:
       ```suggestion
                   _next_row_func = &TupleReader::_agg_key_next_row;
   ```




-- 
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] [incubator-doris] GoGoWen commented on pull request #7515: optimization reading for single rowset

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


   > why not use `TupleReader`?
   > 
   > The build is failed.
   
   Hi jackwener,   thanks for your reply.   It should be TupleReader.  Changed!


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