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
MCOL-4234 and MCOL 5772 cherry-picked into [stable 23.10] (#3226)
* MCOL-4234: improve GROUP BY and ORDER BY interaction (#3194) This patch fixes the problem in MCOL-4234 and also generally improves behavior of GROUP BY. It does so by introducing a "dummy" aggregate and by wrapping columns into it. This allows for columns that are not in GROUP BY to be used more freely, for example, in SELECT * FROM tbl GROUP BY col - all columns that are not "col" will be wrapped into an aggregate and query will proceed to execution. The dummy aggregate itself does nothing more than remember last value passed into it. There also an additional error message that tries to explain what types of expressions can be wrapped into an aggregate. * MCOL-5772: incorrect ORDER BY ordering for a columns not in GROUP BY (#3214) When ORDER BY column is not in GROUP BY, is not an aggregate and there is a SELECT column that is also not an aggregate, there was a problem: ordering happened on the SELECTed column, not ORDERed one. This patch fixes that particular problem and also performs some tidying around newly added aggregate. --------- Co-authored-by: Leonid Fedorov <79837786+mariadb-LeonidFedorov@users.noreply.github.com>
This commit is contained in:
@ -141,6 +141,9 @@ struct gp_walk_info
|
||||
std::vector<execplan::CalpontSystemCatalog::TableAliasName> correlatedTbNameVec;
|
||||
ClauseType clauseType;
|
||||
execplan::CalpontSystemCatalog::TableAliasName viewName;
|
||||
// we can have explicit GROUP BY and implicit one, triggered by aggregate in pojection or ORDER BY.
|
||||
// this flag tells us whether we have either case.
|
||||
bool implicitExplicitGroupBy;
|
||||
bool aggOnSelect;
|
||||
bool hasWindowFunc;
|
||||
bool hasSubSelect;
|
||||
@ -186,6 +189,7 @@ struct gp_walk_info
|
||||
, subSelectType(uint64_t(-1))
|
||||
, subQuery(0)
|
||||
, clauseType(INIT)
|
||||
, implicitExplicitGroupBy(false)
|
||||
, aggOnSelect(false)
|
||||
, hasWindowFunc(false)
|
||||
, hasSubSelect(false)
|
||||
|
Reference in New Issue
Block a user