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/10/08 06:10:53 UTC

[GitHub] [doris] BiteTheDDDDt opened a new pull request, #13166: [Enhancement](scanner) support slipt avg key range

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

   # Proposed changes
   
   
   
   ## Problem summary
   
   Describe your 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 (If Yes, please explain WHY)
       - [ ] 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] HappenLee commented on a diff in pull request #13166: [Enhancement](scanner) support split avg key range

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


##########
be/src/exec/olap_common.h:
##########
@@ -550,6 +554,79 @@ void ColumnValueRange<primitive_type>::convert_to_fixed_value() {
     }
 }
 
+template <>
+bool ColumnValueRange<PrimitiveType::TYPE_STRING>::convert_to_avg_range_value(
+        std::vector<OlapTuple>& begin_scan_keys, std::vector<OlapTuple>& end_scan_keys,
+        size_t step_size);
+
+template <>
+bool ColumnValueRange<PrimitiveType::TYPE_CHAR>::convert_to_avg_range_value(
+        std::vector<OlapTuple>& begin_scan_keys, std::vector<OlapTuple>& end_scan_keys,
+        size_t step_size);
+
+template <>
+bool ColumnValueRange<PrimitiveType::TYPE_VARCHAR>::convert_to_avg_range_value(
+        std::vector<OlapTuple>& begin_scan_keys, std::vector<OlapTuple>& end_scan_keys,
+        size_t step_size);
+
+template <>
+bool ColumnValueRange<PrimitiveType::TYPE_HLL>::convert_to_avg_range_value(
+        std::vector<OlapTuple>& begin_scan_keys, std::vector<OlapTuple>& end_scan_keys,
+        size_t step_size);
+
+template <>
+bool ColumnValueRange<PrimitiveType::TYPE_DECIMALV2>::convert_to_avg_range_value(
+        std::vector<OlapTuple>& begin_scan_keys, std::vector<OlapTuple>& end_scan_keys,
+        size_t step_size);
+
+template <>
+bool ColumnValueRange<PrimitiveType::TYPE_LARGEINT>::convert_to_avg_range_value(
+        std::vector<OlapTuple>& begin_scan_keys, std::vector<OlapTuple>& end_scan_keys,
+        size_t step_size);
+
+template <PrimitiveType primitive_type>
+bool ColumnValueRange<primitive_type>::convert_to_avg_range_value(
+        std::vector<OlapTuple>& begin_scan_keys, std::vector<OlapTuple>& end_scan_keys,
+        size_t step_size) {
+    // Incrementing boolean is denied in C++17, So we use int as bool type
+    using type = std::conditional_t<std::is_same<bool, CppType>::value, int, CppType>;
+    type current = get_range_min_value();
+
+    constexpr bool cant_add = primitive_type == PrimitiveType::TYPE_DATEV2 ||

Review Comment:
   can_not_add ?



##########
be/src/exec/olap_common.cpp:
##########
@@ -59,6 +59,48 @@ void ColumnValueRange<PrimitiveType::TYPE_LARGEINT>::convert_to_fixed_value() {
     return;
 }
 
+template <>

Review Comment:
   maybe better use `#define` to do the thing? and do it in `.h` ?



##########
be/src/exec/olap_common.h:
##########
@@ -945,13 +1022,20 @@ Status OlapScanKeys::extend_scan_key(ColumnValueRange<primitive_type>& range,
         _has_range_value = true;
 
         if (_begin_scan_keys.empty()) {
-            _begin_scan_keys.emplace_back();
-            _begin_scan_keys.back().add_value(cast_to_string<primitive_type, CppType>(
-                                                      range.get_range_min_value(), range.scale()),
-                                              range.contain_null());
-            _end_scan_keys.emplace_back();
-            _end_scan_keys.back().add_value(cast_to_string<primitive_type, CppType>(
-                    range.get_range_max_value(), range.scale()));
+            size_t step_size =
+                    std::max((range.get_convertible_fixed_value_size() + max_scan_key_num - 1) /
+                                     max_scan_key_num,
+                             (size_t)1);

Review Comment:
   why do the cal `step_size` here, not in `convert_to_avg_range_value` and we only pass the para to `max_scan_key_num` replace `step_size` and only need to call function `range.get_convertible_fixed_value_size()` one time



-- 
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] github-actions[bot] commented on pull request #13166: [Enhancement](scanner) support split avg key range

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #13166:
URL: https://github.com/apache/doris/pull/13166#issuecomment-1283765019

   PR approved by anyone and no changes requested.


-- 
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] github-actions[bot] commented on pull request #13166: [Enhancement](scanner) support split avg key range

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #13166:
URL: https://github.com/apache/doris/pull/13166#issuecomment-1283764924

   PR approved by at least one committer and no changes requested.


-- 
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] HappenLee commented on a diff in pull request #13166: [Enhancement](scanner) support split avg key range

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


##########
be/src/exec/olap_common.h:
##########
@@ -508,45 +511,62 @@ size_t ColumnValueRange<primitive_type>::get_convertible_fixed_value_size() cons
     return _high_value - _low_value;
 }
 
-template <>
-void ColumnValueRange<PrimitiveType::TYPE_STRING>::convert_to_fixed_value();
-
-template <>
-void ColumnValueRange<PrimitiveType::TYPE_CHAR>::convert_to_fixed_value();
-
-template <>
-void ColumnValueRange<PrimitiveType::TYPE_VARCHAR>::convert_to_fixed_value();
-
-template <>
-void ColumnValueRange<PrimitiveType::TYPE_HLL>::convert_to_fixed_value();
-
-template <>
-void ColumnValueRange<PrimitiveType::TYPE_DECIMALV2>::convert_to_fixed_value();
+template <PrimitiveType primitive_type>
+bool ColumnValueRange<primitive_type>::convert_to_avg_range_value(
+        std::vector<OlapTuple>& begin_scan_keys, std::vector<OlapTuple>& end_scan_keys,
+        int32_t max_scan_key_num) {
+    constexpr bool reject_type = primitive_type == PrimitiveType::TYPE_LARGEINT ||
+                                 primitive_type == PrimitiveType::TYPE_DECIMALV2 ||
+                                 primitive_type == PrimitiveType::TYPE_HLL ||
+                                 primitive_type == PrimitiveType::TYPE_VARCHAR ||
+                                 primitive_type == PrimitiveType::TYPE_CHAR ||
+                                 primitive_type == PrimitiveType::TYPE_STRING ||
+                                 primitive_type == PrimitiveType::TYPE_BOOLEAN ||
+                                 primitive_type == PrimitiveType::TYPE_DATETIME ||
+                                 primitive_type == PrimitiveType::TYPE_DATETIMEV2;
+    if constexpr (reject_type) {

Review Comment:
   why largeint do not change the range?



-- 
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] HappenLee merged pull request #13166: [Enhancement](scanner) support split avg key range

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


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