[Groonga-mysql-commit] mroonga/mroonga at 83ade0f [master] storage count_skip: BETWEEN arguments exist in WHERE list on MySQL < 5.7

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Jul 1 14:30:31 JST 2016


Kouhei Sutou	2016-07-01 14:30:31 +0900 (Fri, 01 Jul 2016)

  New Revision: 83ade0f4c7521cbc47962a6043e1b5496927769c
  https://github.com/mroonga/mroonga/commit/83ade0f4c7521cbc47962a6043e1b5496927769c

  Message:
    storage count_skip: BETWEEN arguments exist in WHERE list on MySQL < 5.7

  Modified files:
    ha_mroonga.cpp

  Modified: ha_mroonga.cpp (+18 -4)
===================================================================
--- ha_mroonga.cpp    2016-07-01 14:19:42 +0900 (a1902d5)
+++ ha_mroonga.cpp    2016-07-01 14:30:31 +0900 (982362e)
@@ -9967,11 +9967,25 @@ void ha_mroonga::check_count_skip(key_part_map start_key_part_map,
           case Item_func::LE_FUNC:
           case Item_func::GE_FUNC:
           case Item_func::GT_FUNC:
-            target = func_item->arguments()[0];
-            where = where->next->next;
-            break;
           case Item_func::BETWEEN:
-            target = func_item->arguments()[0];
+            {
+              Item **arguments = func_item->arguments();
+              target = arguments[0];
+
+              uint n_arguments = func_item->argument_count();
+              bool argument_in_where = false;
+              for (uint i = 0; i < n_arguments; i++) {
+                if (arguments[i] == where->next) {
+                  argument_in_where = true;
+                  break;
+                }
+              }
+              if (argument_in_where) {
+                for (uint i = 0; i < n_arguments; i++) {
+                  where = where->next;
+                }
+              }
+            }
             break;
           default:
             target = NULL;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index