You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
Merge branch 'MCOL-1201-b' of https://github.com/mariadb-corporation/mariadb-columnstore-engine into MCOL-1201-b
This commit is contained in:
@@ -707,7 +707,6 @@ void debug_walk(const Item* item, void* arg)
|
||||
else if (ref->real_item()->type() == Item::FIELD_ITEM)
|
||||
{
|
||||
Item_field* ifp = (Item_field*)ref->real_item();
|
||||
|
||||
// MCOL-1052 The field referenced presumable came from
|
||||
// extended SELECT list.
|
||||
if ( !ifp->field_name )
|
||||
@@ -719,7 +718,6 @@ void debug_walk(const Item* item, void* arg)
|
||||
cerr << "REF FIELD_ITEM: " << ifp->db_name << '.' << bestTableName(ifp) << '.' <<
|
||||
ifp->field_name << endl;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if (ref->real_item()->type() == Item::FUNC_ITEM)
|
||||
@@ -927,7 +925,6 @@ void debug_walk(const Item* item, void* arg)
|
||||
cerr << "NULL item" << endl;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
cerr << "UNKNOWN_ITEM type " << item->type() << endl;
|
||||
@@ -1009,8 +1006,8 @@ uint32_t buildOuterJoin(gp_walk_info& gwi, SELECT_LEX& select_lex)
|
||||
// View is already processed in view::transform
|
||||
// @bug5319. view is sometimes treated as derived table and
|
||||
// fromSub::transform does not build outer join filters.
|
||||
if (!table_ptr->derived && table_ptr->view)
|
||||
continue;
|
||||
//if (!table_ptr->derived && table_ptr->view)
|
||||
// continue;
|
||||
|
||||
CalpontSystemCatalog:: TableAliasName tan = make_aliasview(
|
||||
(table_ptr->db ? table_ptr->db : ""),
|
||||
@@ -5131,7 +5128,6 @@ void gp_walk(const Item* item, void* arg)
|
||||
if (col->type() != Item::COND_ITEM)
|
||||
{
|
||||
rc = buildReturnedColumn(col, *gwip, gwip->fatalParseError);
|
||||
|
||||
if ( col->type() == Item::FIELD_ITEM )
|
||||
gwip->fatalParseError = false;
|
||||
}
|
||||
@@ -5210,25 +5206,20 @@ void gp_walk(const Item* item, void* arg)
|
||||
{
|
||||
Item_field* ifip = static_cast<Item_field*>(col);
|
||||
std::vector<Item*>::iterator iter = gwip->havingAggColsItems.begin();
|
||||
Item_func_or_sum* isfp = NULL;
|
||||
|
||||
for ( ; iter != gwip->havingAggColsItems.end(); iter++ )
|
||||
Item_func_or_sum *isfp = NULL;
|
||||
for( ;iter != gwip->havingAggColsItems.end(); iter++ )
|
||||
{
|
||||
Item* temp_isfp = *iter;
|
||||
Item *temp_isfp = *iter;
|
||||
isfp = reinterpret_cast<Item_func_or_sum*>(temp_isfp);
|
||||
|
||||
if ( isfp->type() == Item::SUM_FUNC_ITEM &&
|
||||
isfp->result_field == ifip->field )
|
||||
{
|
||||
ReturnedColumn* rc = buildAggregateColumn(isfp, *gwip);
|
||||
|
||||
if (rc)
|
||||
gwip->rcWorkStack.push(rc);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else
|
||||
@@ -8103,7 +8094,7 @@ int cp_get_group_plan(THD* thd, SCSEP& csep, cal_impl_if::cal_group_info& gi)
|
||||
* NULL otherwise
|
||||
***********************************************************/
|
||||
ConstantColumn* buildConstColFromFilter(SimpleColumn* originalSC,
|
||||
gp_walk_info& gwi, cal_group_info& gi)
|
||||
gp_walk_info& gwi, cal_group_info& gi)
|
||||
{
|
||||
execplan::SimpleColumn* simpleCol;
|
||||
execplan::ConstantColumn* constCol;
|
||||
@@ -8111,22 +8102,16 @@ ConstantColumn* buildConstColFromFilter(SimpleColumn* originalSC,
|
||||
execplan::SimpleFilter* simpFilter;
|
||||
execplan::ConstantColumn* result = NULL;
|
||||
std::vector<ParseTree*>::iterator ptIt = gi.pushedPts.begin();
|
||||
|
||||
for (; ptIt != gi.pushedPts.end(); ptIt++)
|
||||
for(; ptIt != gi.pushedPts.end(); ptIt++)
|
||||
{
|
||||
simpFilter = dynamic_cast<execplan::SimpleFilter*>((*ptIt)->data());
|
||||
|
||||
if (simpFilter == NULL)
|
||||
continue;
|
||||
|
||||
simpleCol = dynamic_cast<execplan::SimpleColumn*>(simpFilter->lhs());
|
||||
constCol = dynamic_cast<execplan::ConstantColumn*>(simpFilter->rhs());
|
||||
|
||||
if (simpleCol == NULL || constCol == NULL)
|
||||
if(simpleCol == NULL || constCol == NULL)
|
||||
continue;
|
||||
|
||||
op = simpFilter->op();
|
||||
|
||||
if ( originalSC->sameColumn(dynamic_cast<execplan::ReturnedColumn*>(simpleCol))
|
||||
&& op.get()->op() == OP_EQ && constCol)
|
||||
{
|
||||
@@ -8139,7 +8124,6 @@ ConstantColumn* buildConstColFromFilter(SimpleColumn* originalSC,
|
||||
result = constCol;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -8534,7 +8518,7 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
|
||||
// MCOL-1052 Replace SimpleColumn with ConstantColumn,
|
||||
// since it must have a single value only.
|
||||
if (constCol)
|
||||
if(constCol)
|
||||
{
|
||||
gwi.returnedCols.push_back(spcc);
|
||||
gwi.columnMap.insert(CalpontSelectExecutionPlan::ColumnMap::value_type(string(ifp->field_name), spcc));
|
||||
@@ -8544,7 +8528,6 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
gwi.returnedCols.push_back(spsc);
|
||||
gwi.columnMap.insert(CalpontSelectExecutionPlan::ColumnMap::value_type(string(ifp->field_name), spsc));
|
||||
}
|
||||
|
||||
TABLE_LIST* tmp = 0;
|
||||
|
||||
if (ifp->cached_table)
|
||||
@@ -8581,7 +8564,6 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
gwi.returnedCols.push_back(spac);
|
||||
// This item will be used in HAVING later.
|
||||
Item_func_or_sum* isfp = reinterpret_cast<Item_func_or_sum*>(item);
|
||||
|
||||
if ( ! isfp->name_length )
|
||||
{
|
||||
gwi.havingAggColsItems.push_back(item);
|
||||
@@ -9499,44 +9481,38 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
if ( rc && ord_item->type() == Item::FIELD_ITEM )
|
||||
{
|
||||
execplan::CalpontSelectExecutionPlan::ReturnedColumnList::iterator iter = gwi.groupByCols.begin();
|
||||
|
||||
for ( ; iter != gwi.groupByCols.end(); iter++ )
|
||||
for( ; iter != gwi.groupByCols.end(); iter++ )
|
||||
{
|
||||
if ( rc->sameColumn((*iter).get()) )
|
||||
if( rc->sameColumn((*iter).get()) )
|
||||
break;
|
||||
}
|
||||
|
||||
// MCOL-1052 Find and remove the optimized field
|
||||
// from ORDER using cond_pushed filters.
|
||||
if (buildConstColFromFilter(
|
||||
dynamic_cast<SimpleColumn*>(rc), gwi, gi))
|
||||
if(buildConstColFromFilter(
|
||||
dynamic_cast<SimpleColumn*>(rc),gwi, gi))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
// MCOL-1052 GROUP BY items list doesn't contain
|
||||
// this ORDER BY item.
|
||||
if ( iter == gwi.groupByCols.end() )
|
||||
{
|
||||
Item_ident* iip = reinterpret_cast<Item_ident*>(ord_item);
|
||||
Item_ident *iip = reinterpret_cast<Item_ident*>(ord_item);
|
||||
std::ostringstream ostream;
|
||||
ostream << "'";
|
||||
|
||||
if (iip->db_name)
|
||||
ostream << iip->db_name << '.';
|
||||
else
|
||||
ostream << "unknown db" << '.';
|
||||
|
||||
if (iip->table_name)
|
||||
ostream << iip->table_name << '.';
|
||||
else
|
||||
ostream << "unknown table" << '.';
|
||||
|
||||
if (iip->field_name)
|
||||
ostream << iip->field_name;
|
||||
else
|
||||
ostream << "unknown field";
|
||||
|
||||
ostream << "'";
|
||||
Message::Args args;
|
||||
args.add(ostream.str());
|
||||
@@ -9567,7 +9543,6 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
||||
if (!rc)
|
||||
{
|
||||
Item* item_ptr = ordercol->item_ptr;
|
||||
|
||||
if (item_ptr)
|
||||
rc = buildReturnedColumn(item_ptr, gwi, gwi.fatalParseError);
|
||||
}
|
||||
|
@@ -427,7 +427,7 @@ int vbin2hex(const uint8_t* p, const unsigned l, char* o)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool handler_flag = false)
|
||||
int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool handler_flag=false)
|
||||
{
|
||||
int rc = HA_ERR_END_OF_FILE;
|
||||
int num_attr = ti.msTablePtr->s->fields;
|
||||
@@ -469,7 +469,6 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
|
||||
{
|
||||
Field** f;
|
||||
f = ti.msTablePtr->field;
|
||||
|
||||
//set all fields to null in null col bitmap
|
||||
if (!handler_flag)
|
||||
memset(buf, -1, ti.msTablePtr->s->null_bytes);
|
||||
@@ -477,7 +476,6 @@ int fetchNextRow(uchar* buf, cal_table_info& ti, cal_connection_info* ci, bool h
|
||||
{
|
||||
memset(ti.msTablePtr->null_flags, -1, ti.msTablePtr->s->null_bytes);
|
||||
}
|
||||
|
||||
std::vector<CalpontSystemCatalog::ColType>& colTypes = ti.tpl_scan_ctx->ctp;
|
||||
int64_t intColVal = 0;
|
||||
uint64_t uintColVal = 0;
|
||||
@@ -5278,16 +5276,15 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
||||
execplan::CalpontSelectExecutionPlan::ColumnMap::iterator colMapIter;
|
||||
execplan::CalpontSelectExecutionPlan::ColumnMap::iterator condColMapIter;
|
||||
execplan::ParseTree* ptIt;
|
||||
for (TABLE_LIST* tl = gi.groupByTables; tl; tl = tl->next_local)
|
||||
for(TABLE_LIST* tl = gi.groupByTables; tl; tl=tl->next_local)
|
||||
{
|
||||
mapiter = ci->tableMap.find(tl->table);
|
||||
|
||||
if (mapiter != ci->tableMap.end() && mapiter->second.condInfo != NULL
|
||||
if(mapiter != ci->tableMap.end() && mapiter->second.condInfo != NULL
|
||||
&& mapiter->second.condInfo->condPush)
|
||||
{
|
||||
while (!mapiter->second.condInfo->ptWorkStack.empty())
|
||||
while(!mapiter->second.condInfo->ptWorkStack.empty())
|
||||
{
|
||||
ptIt = mapiter->second.condInfo->ptWorkStack.top();
|
||||
ptIt=mapiter->second.condInfo->ptWorkStack.top();
|
||||
mapiter->second.condInfo->ptWorkStack.pop();
|
||||
gi.pushedPts.push_back(ptIt);
|
||||
}
|
||||
@@ -5321,14 +5318,14 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE
|
||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 9999, msg.c_str());
|
||||
}
|
||||
|
||||
#ifdef PLAN_HEX_FILE
|
||||
#ifdef PLAN_HEX_FILE
|
||||
// plan serialization
|
||||
ifstream ifs("/tmp/li1-plan.hex");
|
||||
ByteStream bs1;
|
||||
ifs >> bs1;
|
||||
ifs.close();
|
||||
csep->unserialize(bs1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (ci->traceFlags & 1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user