You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "jacktengg (via GitHub)" <gi...@apache.org> on 2023/03/02 08:06:26 UTC

[GitHub] [doris] jacktengg opened a new pull request, #17336: [opt](string) optimize string equal comparision

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

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Optimize string euqal and not-equal comparison by using memcmp_small_allow_overflow15.
   
   ## Checklist(Required)
   
   * [ ] Does it affect the original behavior
   * [ ] Has unit tests been added
   * [ ] Has document been added or modified
   * [ ] Does it need to update dependencies
   * [ ] Is this PR support rollback (If NO, please explain WHY)
   
   ## 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] jacktengg commented on pull request #17336: [opt](string) optimize string equal comparision

Posted by "jacktengg (via GitHub)" <gi...@apache.org>.
jacktengg commented on PR #17336:
URL: https://github.com/apache/doris/pull/17336#issuecomment-1451491292

   run buildall


-- 
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 a diff in pull request #17336: [opt](string) optimize string equal comparision

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on code in PR #17336:
URL: https://github.com/apache/doris/pull/17336#discussion_r1122726419


##########
be/src/vec/functions/functions_comparison.h:
##########
@@ -291,6 +403,75 @@ class FunctionComparison : public IFunction {
         return Status::OK();
     }
 
+    Status execute_string(Block& block, size_t result, const IColumn* c0, const IColumn* c1) {
+        const ColumnString* c0_string = check_and_get_column<ColumnString>(c0);
+        const ColumnString* c1_string = check_and_get_column<ColumnString>(c1);
+        const ColumnConst* c0_const = check_and_get_column_const_string_or_fixedstring(c0);
+        const ColumnConst* c1_const = check_and_get_column_const_string_or_fixedstring(c1);
+        if (!((c0_string || c0_const) && (c1_string || c1_const))) {
+            return Status::NotSupported("Illegal columns {}, {} of argument of function {}",
+                                        c0->get_name(), c1->get_name(), name);
+        }
+
+        if (c0_const && c1_const) {
+            execute_generic_identical_types(block, result, c0, c1);
+            return Status::OK();
+        }
+
+        const ColumnString::Chars* c0_const_chars = nullptr;
+        const ColumnString::Chars* c1_const_chars = nullptr;
+        ColumnString::Offset c0_const_size = 0;
+        ColumnString::Offset c1_const_size = 0;
+
+        if (c0_const) {
+            const ColumnString* c0_const_string =
+                    check_and_get_column<ColumnString>(&c0_const->get_data_column());
+
+            if (c0_const_string) {
+                c0_const_chars = &c0_const_string->get_chars();
+                c0_const_size = c0_const_string->get_data_at(0).size;
+            } else

Review Comment:
   warning: statement should be inside braces [readability-braces-around-statements]
   
   ```suggestion
               } else {
   ```
   
   be/src/vec/functions/functions_comparison.h:434:
   ```diff
   -                                             c0->get_name(), name);
   +                                             c0->get_name(), name);
   + }
   ```
   



##########
be/src/vec/functions/functions_comparison.h:
##########
@@ -291,6 +403,75 @@
         return Status::OK();
     }
 
+    Status execute_string(Block& block, size_t result, const IColumn* c0, const IColumn* c1) {
+        const ColumnString* c0_string = check_and_get_column<ColumnString>(c0);
+        const ColumnString* c1_string = check_and_get_column<ColumnString>(c1);
+        const ColumnConst* c0_const = check_and_get_column_const_string_or_fixedstring(c0);
+        const ColumnConst* c1_const = check_and_get_column_const_string_or_fixedstring(c1);
+        if (!((c0_string || c0_const) && (c1_string || c1_const))) {
+            return Status::NotSupported("Illegal columns {}, {} of argument of function {}",
+                                        c0->get_name(), c1->get_name(), name);
+        }
+
+        if (c0_const && c1_const) {
+            execute_generic_identical_types(block, result, c0, c1);
+            return Status::OK();
+        }
+
+        const ColumnString::Chars* c0_const_chars = nullptr;
+        const ColumnString::Chars* c1_const_chars = nullptr;
+        ColumnString::Offset c0_const_size = 0;
+        ColumnString::Offset c1_const_size = 0;
+
+        if (c0_const) {
+            const ColumnString* c0_const_string =
+                    check_and_get_column<ColumnString>(&c0_const->get_data_column());
+
+            if (c0_const_string) {
+                c0_const_chars = &c0_const_string->get_chars();
+                c0_const_size = c0_const_string->get_data_at(0).size;
+            } else
+                return Status::NotSupported("Illegal columns {}, of argument of function {}",
+                                            c0->get_name(), name);
+        }
+
+        if (c1_const) {
+            const ColumnString* c1_const_string =
+                    check_and_get_column<ColumnString>(&c1_const->get_data_column());
+
+            if (c1_const_string) {
+                c1_const_chars = &c1_const_string->get_chars();
+                c1_const_size = c1_const_string->get_data_at(0).size;
+            } else

Review Comment:
   warning: statement should be inside braces [readability-braces-around-statements]
   
   ```suggestion
               } else {
   ```
   
   be/src/vec/functions/functions_comparison.h:446:
   ```diff
   -                                             c1->get_name(), name);
   +                                             c1->get_name(), name);
   + }
   ```
   



-- 
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] cambyzju commented on pull request #17336: [opt](string) optimize string equal comparision

Posted by "cambyzju (via GitHub)" <gi...@apache.org>.
cambyzju commented on PR #17336:
URL: https://github.com/apache/doris/pull/17336#issuecomment-1451598754

   Please give some performance result, before and after this pr.


-- 
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 #17336: [opt](string) optimize string equal comparision

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #17336:
URL: https://github.com/apache/doris/pull/17336#issuecomment-1451468590

   clang-tidy review says "All clean, LGTM! :+1:"


-- 
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 #17336: [opt](string) optimize string equal comparision

Posted by "yiguolei (via GitHub)" <gi...@apache.org>.
yiguolei merged PR #17336:
URL: https://github.com/apache/doris/pull/17336


-- 
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] jacktengg commented on pull request #17336: [opt](string) optimize string equal comparision

Posted by "jacktengg (via GitHub)" <gi...@apache.org>.
jacktengg commented on PR #17336:
URL: https://github.com/apache/doris/pull/17336#issuecomment-1451456822

   run buildall


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