You've already forked mariadb-columnstore-engine
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:
@ -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
|
||||
|
@ -157,6 +157,8 @@ struct gp_walk_info
|
||||
bool cs_vtable_is_update_with_derive;
|
||||
bool cs_vtable_impossible_where_on_union;
|
||||
|
||||
bool isGroupByHandler;
|
||||
|
||||
gp_walk_info() : sessionid(0),
|
||||
fatalParseError(false),
|
||||
condPush(false),
|
||||
@ -175,7 +177,8 @@ struct gp_walk_info
|
||||
recursionHWM(0),
|
||||
inCaseStmt(false),
|
||||
cs_vtable_is_update_with_derive(false),
|
||||
cs_vtable_impossible_where_on_union(false)
|
||||
cs_vtable_impossible_where_on_union(false),
|
||||
isGroupByHandler(false)
|
||||
{}
|
||||
|
||||
~gp_walk_info() {}
|
||||
@ -358,7 +361,7 @@ const std::string bestTableName(const Item_field* ifp);
|
||||
bool isMCSTable(TABLE* table_ptr);
|
||||
|
||||
// execution plan util functions prototypes
|
||||
execplan::ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupport, bool pushdownHand = false);
|
||||
execplan::ReturnedColumn* buildReturnedColumn(Item* item, gp_walk_info& gwi, bool& nonSupport, bool pushdownHand = false, bool isRefItem = false);
|
||||
execplan::ReturnedColumn* buildFunctionColumn(Item_func* item, gp_walk_info& gwi, bool& nonSupport, bool pushdownHand = false, bool selectBetweenIn = false);
|
||||
execplan::ArithmeticColumn* buildArithmeticColumn(Item_func* item, gp_walk_info& gwi, bool& nonSupport, bool pushdownHand = false);
|
||||
execplan::ConstantColumn* buildDecimalColumn(Item* item, gp_walk_info& gwi);
|
||||
|
Reference in New Issue
Block a user