1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

Merge pull request #875 from tntnatbry/fix-gbh-aggregate

Build an aggregate column from the extended select list in the group by handler.
This commit is contained in:
Andrew Hutchings
2019-09-26 08:47:56 +01:00
committed by GitHub
2 changed files with 14 additions and 4 deletions

View File

@ -3121,7 +3121,7 @@ CalpontSystemCatalog::ColType colType_MysqlToIDB (const Item* item)
return ct;
}
ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupport, bool pushdownHand)
ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupport, bool pushdownHand, bool isRefItem)
{
ReturnedColumn* rc = NULL;
@ -3141,6 +3141,12 @@ ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupp
case Item::FIELD_ITEM:
{
Item_field* ifp = (Item_field*)item;
if (isRefItem && gwi.isGroupByHandler && !gwi.extSelAggColsItems.empty())
{
return buildAggFrmTempField(ifp, gwi);
}
return buildSimpleColumn(ifp, gwi);
}
case Item::CONST_ITEM:
@ -5615,7 +5621,7 @@ void gp_walk(const Item* item, void* arg)
if (col->type() != Item::COND_ITEM)
{
rc = buildReturnedColumn(col, *gwip, gwip->fatalParseError);
rc = buildReturnedColumn(col, *gwip, gwip->fatalParseError, false, true);
if ( col->type() == Item::FIELD_ITEM )
gwip->fatalParseError = false;
@ -8108,6 +8114,7 @@ int cp_get_group_plan(THD* thd, SCSEP& csep, cal_impl_if::cal_group_info& gi)
SELECT_LEX *select_lex = gi.groupByTables->select_lex;
gp_walk_info gwi;
gwi.thd = thd;
gwi.isGroupByHandler = true;
int status = getGroupPlan(gwi, *select_lex, csep, gi);
#ifdef DEBUG_WALK_COND