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
MCOL-1052 WIP Use SELECT fields referenced in HAVING items list.
This commit is contained in:
@ -5289,6 +5289,8 @@ void gp_walk(const Item* item, void* arg)
|
|||||||
rc = buildReturnedColumnGr(col, *gwip, gwip->fatalParseError);
|
rc = buildReturnedColumnGr(col, *gwip, gwip->fatalParseError);
|
||||||
} else*/
|
} else*/
|
||||||
rc = buildReturnedColumn(col, *gwip, gwip->fatalParseError);
|
rc = buildReturnedColumn(col, *gwip, gwip->fatalParseError);
|
||||||
|
if ( col->type() == Item::FIELD_ITEM )
|
||||||
|
gwip->fatalParseError = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimpleColumn* sc = dynamic_cast<SimpleColumn*>(rc);
|
SimpleColumn* sc = dynamic_cast<SimpleColumn*>(rc);
|
||||||
@ -5361,6 +5363,19 @@ void gp_walk(const Item* item, void* arg)
|
|||||||
Item_func* ifp = (Item_func*)col;
|
Item_func* ifp = (Item_func*)col;
|
||||||
gwip->ptWorkStack.push(buildParseTree(ifp, *gwip, gwip->fatalParseError));
|
gwip->ptWorkStack.push(buildParseTree(ifp, *gwip, gwip->fatalParseError));
|
||||||
}
|
}
|
||||||
|
else if (col->type() == Item::FIELD_ITEM && gwip->clauseType == HAVING)
|
||||||
|
{
|
||||||
|
// Найти item в списке groupByFields
|
||||||
|
Item_func_or_sum* isfp = reinterpret_cast<Item_func_or_sum*>(gwip->havingAggColsItems[0]);
|
||||||
|
if ( isfp->type() == Item::SUM_FUNC_ITEM )
|
||||||
|
{
|
||||||
|
ReturnedColumn* rc = buildAggregateColumn(isfp, *gwip);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rc)
|
||||||
|
gwip->rcWorkStack.push(rc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
cando = false;
|
cando = false;
|
||||||
|
|
||||||
@ -8725,6 +8740,13 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
|||||||
// add this agg col to returnedColumnList
|
// add this agg col to returnedColumnList
|
||||||
boost::shared_ptr<ReturnedColumn> spac(ac);
|
boost::shared_ptr<ReturnedColumn> spac(ac);
|
||||||
gwi.returnedCols.push_back(spac);
|
gwi.returnedCols.push_back(spac);
|
||||||
|
// This item will be used in HAVING clause later.
|
||||||
|
Item_func_or_sum* isfp = reinterpret_cast<Item_func_or_sum*>(item);
|
||||||
|
if ( ! isfp->name_length )
|
||||||
|
{
|
||||||
|
gwi.havingAggColsItems.push_back(item);
|
||||||
|
}
|
||||||
|
|
||||||
gwi.selectCols.push_back('`' + escapeBackTick(spac->alias().c_str()) + '`');
|
gwi.selectCols.push_back('`' + escapeBackTick(spac->alias().c_str()) + '`');
|
||||||
String str(256);
|
String str(256);
|
||||||
item->print(&str, QT_INFINIDB_NO_QUOTE);
|
item->print(&str, QT_INFINIDB_NO_QUOTE);
|
||||||
|
@ -99,6 +99,7 @@ struct gp_walk_info
|
|||||||
execplan::CalpontSelectExecutionPlan::ReturnedColumnList groupByCols;
|
execplan::CalpontSelectExecutionPlan::ReturnedColumnList groupByCols;
|
||||||
execplan::CalpontSelectExecutionPlan::ReturnedColumnList subGroupByCols;
|
execplan::CalpontSelectExecutionPlan::ReturnedColumnList subGroupByCols;
|
||||||
execplan::CalpontSelectExecutionPlan::ReturnedColumnList orderByCols;
|
execplan::CalpontSelectExecutionPlan::ReturnedColumnList orderByCols;
|
||||||
|
std::vector <Item*> havingAggColsItems;
|
||||||
execplan::CalpontSelectExecutionPlan::ColumnMap columnMap;
|
execplan::CalpontSelectExecutionPlan::ColumnMap columnMap;
|
||||||
// This vector temporarily hold the projection columns to be added
|
// This vector temporarily hold the projection columns to be added
|
||||||
// to the returnedCols vector for subquery processing. It will be appended
|
// to the returnedCols vector for subquery processing. It will be appended
|
||||||
|
Reference in New Issue
Block a user