You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
Derived tables no longer are cached. Fix optimizer to handle this fact
This commit is contained in:
@ -343,7 +343,10 @@ static void calpont_set_error(THD* thd, uint64_t errCode, LEX_STRING* args, uint
|
|||||||
|
|
||||||
ha_calpont::ha_calpont(handlerton *hton, TABLE_SHARE *table_arg) :
|
ha_calpont::ha_calpont(handlerton *hton, TABLE_SHARE *table_arg) :
|
||||||
handler(hton, table_arg),
|
handler(hton, table_arg),
|
||||||
int_table_flags(HA_BINLOG_STMT_CAPABLE | HA_TABLE_SCAN_ON_INDEX | HA_CAN_TABLE_CONDITION_PUSHDOWN)
|
int_table_flags(HA_BINLOG_STMT_CAPABLE |
|
||||||
|
HA_TABLE_SCAN_ON_INDEX |
|
||||||
|
HA_CAN_TABLE_CONDITION_PUSHDOWN |
|
||||||
|
HA_FAST_KEY_READ)
|
||||||
// int_table_flags(HA_NO_BLOBS | HA_BINLOG_STMT_CAPABLE)
|
// int_table_flags(HA_NO_BLOBS | HA_BINLOG_STMT_CAPABLE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -421,13 +421,6 @@ void debug_walk(const Item *item, void *arg)
|
|||||||
case Item::SUM_FUNC_ITEM:
|
case Item::SUM_FUNC_ITEM:
|
||||||
{
|
{
|
||||||
Item_sum* isp = (Item_sum*)item;
|
Item_sum* isp = (Item_sum*)item;
|
||||||
Item_sum_int* isip = 0;
|
|
||||||
Item_sum_sum* isdp = 0;
|
|
||||||
Item_sum_avg* isap = 0;
|
|
||||||
Item_sum_count* iscp = 0;
|
|
||||||
Item_sum_count* iscdp = 0;
|
|
||||||
Item_sum_min* isnp = 0;
|
|
||||||
Item_sum_max* isxp = 0;
|
|
||||||
char* item_name = item->name;
|
char* item_name = item->name;
|
||||||
if (!item_name)
|
if (!item_name)
|
||||||
{
|
{
|
||||||
@ -436,31 +429,24 @@ void debug_walk(const Item *item, void *arg)
|
|||||||
switch (isp->sum_func())
|
switch (isp->sum_func())
|
||||||
{
|
{
|
||||||
case Item_sum::SUM_FUNC:
|
case Item_sum::SUM_FUNC:
|
||||||
isip = (Item_sum_int*)isp;
|
|
||||||
cout << "SUM_FUNC: " << item_name << endl;
|
cout << "SUM_FUNC: " << item_name << endl;
|
||||||
break;
|
break;
|
||||||
case Item_sum::SUM_DISTINCT_FUNC:
|
case Item_sum::SUM_DISTINCT_FUNC:
|
||||||
isdp = (Item_sum_sum*)isp;
|
|
||||||
cout << "SUM_DISTINCT_FUNC: " << item_name << endl;
|
cout << "SUM_DISTINCT_FUNC: " << item_name << endl;
|
||||||
break;
|
break;
|
||||||
case Item_sum::AVG_FUNC:
|
case Item_sum::AVG_FUNC:
|
||||||
isap = (Item_sum_avg*)isp;
|
|
||||||
cout << "AVG_FUNC: " << item_name << endl;
|
cout << "AVG_FUNC: " << item_name << endl;
|
||||||
break;
|
break;
|
||||||
case Item_sum::COUNT_FUNC:
|
case Item_sum::COUNT_FUNC:
|
||||||
iscp = (Item_sum_count*)isp;
|
|
||||||
cout << "COUNT_FUNC: " << item_name << endl;
|
cout << "COUNT_FUNC: " << item_name << endl;
|
||||||
break;
|
break;
|
||||||
case Item_sum::COUNT_DISTINCT_FUNC:
|
case Item_sum::COUNT_DISTINCT_FUNC:
|
||||||
iscdp = (Item_sum_count*)isp;
|
|
||||||
cout << "COUNT_DISTINCT_FUNC: " << item_name << endl;
|
cout << "COUNT_DISTINCT_FUNC: " << item_name << endl;
|
||||||
break;
|
break;
|
||||||
case Item_sum::MIN_FUNC:
|
case Item_sum::MIN_FUNC:
|
||||||
isnp = (Item_sum_min*)isp;
|
|
||||||
cout << "MIN_FUNC: " << item_name << endl;
|
cout << "MIN_FUNC: " << item_name << endl;
|
||||||
break;
|
break;
|
||||||
case Item_sum::MAX_FUNC:
|
case Item_sum::MAX_FUNC:
|
||||||
isxp = (Item_sum_max*)isp;
|
|
||||||
cout << "MAX_FUNC: " << item_name << endl;
|
cout << "MAX_FUNC: " << item_name << endl;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -643,16 +629,13 @@ uint32_t buildOuterJoin(gp_walk_info& gwi, SELECT_LEX& select_lex)
|
|||||||
// check non-collapsed outer join
|
// check non-collapsed outer join
|
||||||
// this set contains all processed embedded joins. duplicate joins are ignored
|
// this set contains all processed embedded joins. duplicate joins are ignored
|
||||||
set<TABLE_LIST*> embeddingSet;
|
set<TABLE_LIST*> embeddingSet;
|
||||||
// TABLE_LIST* table_ptr = select_lex.get_table_list();
|
TABLE_LIST* table_ptr = select_lex.get_table_list();
|
||||||
List_iterator_fast<TABLE_LIST> ti(select_lex.top_join_list);
|
|
||||||
TABLE_LIST *table_ptr;
|
|
||||||
gp_walk_info gwi_outer = gwi;
|
gp_walk_info gwi_outer = gwi;
|
||||||
gwi_outer.subQuery = NULL;
|
gwi_outer.subQuery = NULL;
|
||||||
gwi_outer.hasSubSelect = false;
|
gwi_outer.hasSubSelect = false;
|
||||||
vector <Item_field*> tmpVec;
|
vector <Item_field*> tmpVec;
|
||||||
|
|
||||||
// for (; table_ptr; table_ptr= table_ptr->next_local)
|
for (; table_ptr; table_ptr= table_ptr->next_local)
|
||||||
while ((table_ptr= ti++))
|
|
||||||
{
|
{
|
||||||
gwi_outer.innerTables.clear();
|
gwi_outer.innerTables.clear();
|
||||||
clearStacks(gwi_outer);
|
clearStacks(gwi_outer);
|
||||||
@ -1616,7 +1599,13 @@ SimpleColumn* buildSimpleColFromDerivedTable(gp_walk_info& gwi, Item_field* ifp)
|
|||||||
|
|
||||||
// @bug5634, @bug5635. mark used derived col on derived table.
|
// @bug5634, @bug5635. mark used derived col on derived table.
|
||||||
// outer join inner table filter can not be moved in
|
// outer join inner table filter can not be moved in
|
||||||
if (!(ifp->cached_table && ifp->cached_table->outer_join))
|
// MariaDB 10.1: cached_table is never true for derived tables.
|
||||||
|
// Find another way to determine outer_join
|
||||||
|
if (ifp->context &&
|
||||||
|
ifp->context->table_list &&
|
||||||
|
ifp->context->table_list->next_local &&
|
||||||
|
!ifp->context->table_list->next_local->outer_join)
|
||||||
|
// if ((ifp->cached_table && !ifp->cached_table->outer_join))
|
||||||
{
|
{
|
||||||
sc->derivedTable(derivedName);
|
sc->derivedTable(derivedName);
|
||||||
sc->derivedRefCol(cols[j].get());
|
sc->derivedRefCol(cols[j].get());
|
||||||
@ -4331,7 +4320,6 @@ void parse_item (Item *item, vector<Item_field*>& field_vec, bool& hasNonSupport
|
|||||||
parseInfo |= CORRELATED;
|
parseInfo |= CORRELATED;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Item** sfitempp = isp->arguments();
|
|
||||||
for (uint32_t i = 0; i < isp->argument_count(); i++)
|
for (uint32_t i = 0; i < isp->argument_count(); i++)
|
||||||
parse_item(isp->arguments()[i], field_vec, hasNonSupportItem, parseInfo);
|
parse_item(isp->arguments()[i], field_vec, hasNonSupportItem, parseInfo);
|
||||||
// parse_item(sfitempp[i], field_vec, hasNonSupportItem, parseInfo);
|
// parse_item(sfitempp[i], field_vec, hasNonSupportItem, parseInfo);
|
||||||
@ -4566,11 +4554,11 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i
|
|||||||
// @todo process from subquery
|
// @todo process from subquery
|
||||||
if (table_ptr->derived)
|
if (table_ptr->derived)
|
||||||
{
|
{
|
||||||
//cout << "DERIVED TABLE DEBUG" << endl;
|
cout << "DERIVED TABLE DEBUG" << endl;
|
||||||
//String str;
|
String str;
|
||||||
//(table_ptr->derived->first_select())->print(gwi.thd, &str, QT_INFINIDB_DERIVED);
|
(table_ptr->derived->first_select())->print(gwi.thd, &str, QT_INFINIDB_DERIVED);
|
||||||
//cout << str.ptr() << endl;
|
cout << str.ptr() << endl;
|
||||||
//cout << "DERIVED TABLE DEBUG END" << endl;
|
cout << "DERIVED TABLE DEBUG END" << endl;
|
||||||
|
|
||||||
SELECT_LEX *select_cursor = table_ptr->derived->first_select();
|
SELECT_LEX *select_cursor = table_ptr->derived->first_select();
|
||||||
FromSubQuery fromSub(gwi, select_cursor);
|
FromSubQuery fromSub(gwi, select_cursor);
|
||||||
|
Reference in New Issue
Block a user