summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-10-11 13:08:53 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2019-10-13 09:40:41 +0200
commitebeb4f93e8de0e6763a55dbf9a265afc32459608 (patch)
treeae243cc0b95151818645a4d5630bcaffce6efd2d /sql
parenta6de6408042267558d9fb1f8efa884f8d09d1a34 (diff)
downloadmariadb-git-ebeb4f93e8de0e6763a55dbf9a265afc32459608.tar.gz
MDEV-16327: Server doesn't account for engines that supports OFFSET on their own.
Engine get LIMIT/OFFSET info an can it use/reset.
Diffstat (limited to 'sql')
-rw-r--r--sql/group_by_handler.h7
-rw-r--r--sql/sql_limit.h6
-rw-r--r--sql/sql_select.cc3
3 files changed, 14 insertions, 2 deletions
diff --git a/sql/group_by_handler.h b/sql/group_by_handler.h
index 97ee44d73d3..ff3b204fa56 100644
--- a/sql/group_by_handler.h
+++ b/sql/group_by_handler.h
@@ -14,6 +14,10 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
+#ifndef GROUP_BY_HANDLER_INCLUDED
+#define GROUP_BY_HANDLER_INCLUDED
+
+class Select_limit_counters;
/*
This file implements the group_by_handler interface. This interface
can be used by storage handlers that can intercept summary or GROUP
@@ -56,7 +60,7 @@ struct Query
ORDER *order_by;
Item *having;
// LIMIT
- //ha_rows select_limit_cnt, offset_limit_cnt;
+ Select_limit_counters *limit;
};
class group_by_handler
@@ -101,3 +105,4 @@ public:
virtual void print_error(int error, myf errflag);
};
+#endif //GROUP_BY_HANDLER_INCLUDED
diff --git a/sql/sql_limit.h b/sql/sql_limit.h
index 93a9aae85af..a4fcedac14a 100644
--- a/sql/sql_limit.h
+++ b/sql/sql_limit.h
@@ -28,6 +28,10 @@ class Select_limit_counters
Select_limit_counters():
select_limit_cnt(0), offset_limit_cnt(0)
{};
+ Select_limit_counters(Select_limit_counters &orig):
+ select_limit_cnt(orig.select_limit_cnt),
+ offset_limit_cnt(orig.offset_limit_cnt)
+ {};
void set_limit(ha_rows limit, ha_rows offset)
{
@@ -48,6 +52,8 @@ class Select_limit_counters
bool is_unlimited()
{ return select_limit_cnt == HA_POS_ERROR; }
+ bool is_unrestricted()
+ { return select_limit_cnt == HA_POS_ERROR && offset_limit_cnt == 0; }
void set_unlimited()
{ select_limit_cnt= HA_POS_ERROR; offset_limit_cnt= 0; }
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e3c4277f960..824d9b4e5bb 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -3146,7 +3146,8 @@ bool JOIN::make_aggr_tables_info()
{
/* Check if the storage engine can intercept the query */
Query query= {&all_fields, select_distinct, tables_list, conds,
- group_list, order ? order : group_list, having};
+ group_list, order ? order : group_list, having,
+ &select_lex->master_unit()->lim};
group_by_handler *gbh= ht->create_group_by(thd, &query);
if (gbh)