summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-02-12 22:56:24 -0800
committerIgor Babaev <igor@askmonty.org>2019-02-12 22:56:24 -0800
commit27c3abde3071ad2010cbcda5b07435ad15364a70 (patch)
tree0d4e4066762076beaba6c8d2e774202be7146e2c /sql/sql_derived.cc
parent17d00d9a94da2c2b57fc7cf75036d92ee6dc9298 (diff)
downloadmariadb-git-27c3abde3071ad2010cbcda5b07435ad15364a70.tar.gz
MDEV-17096 Pushdown of simple derived tables to storage engines
MDEV-17631 select_handler for a full query pushdown Added comments and file headers for files introduced in these tasks.
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 564049e59e1..fbd8365e619 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -932,6 +932,7 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived)
if (derived->is_materialized_derived() && derived->dt_handler)
{
+ /* Create an object for execution of the query specifying the table */
if (!(derived->pushdown_derived=
new (thd->mem_root) Pushdown_derived(derived, derived->dt_handler)))
{
@@ -1151,6 +1152,7 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived)
int res;
if (unit->executed)
DBUG_RETURN(FALSE);
+ /* Execute the query that specifies the derived table by a foreign engine */
res= derived->pushdown_derived->execute();
unit->executed= true;
delete derived->pushdown_derived;
@@ -1457,6 +1459,25 @@ bool pushdown_cond_for_derived(THD *thd, Item *cond, TABLE_LIST *derived)
}
+/**
+ @brief
+ Look for provision of the derived_handler interface by a foreign engine
+
+ @param thd The thread handler
+
+ @details
+ The function looks through its tables of the query that specifies this
+ derived table searching for a table whose handlerton owns a
+ create_derived call-back function. If the call of this function returns
+ a derived_handler interface object then the server will push the query
+ specifying the derived table into this engine.
+ This is a responsibility of the create_derived call-back function to
+ check whether the engine can execute the query.
+
+ @retval the found derived_handler if the search is successful
+ 0 otherwise
+*/
+
derived_handler *TABLE_LIST::find_derived_handler(THD *thd)
{
if (!derived || is_recursive_with_table())