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
Merge pull request #1367 from dhall-MariaDB/MCOL-3827
MCOL-3827 Optimize out sort on SubQuery in Select
This commit is contained in:
@ -823,7 +823,7 @@ void addOrderByAndLimit(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo)
|
|||||||
if (sc == NULL)
|
if (sc == NULL)
|
||||||
{
|
{
|
||||||
const ReturnedColumn* rc = dynamic_cast<const ReturnedColumn*>(orderByCols[i].get());
|
const ReturnedColumn* rc = dynamic_cast<const ReturnedColumn*>(orderByCols[i].get());
|
||||||
uint64_t eid = rc->expressionId();
|
uint32_t eid = rc->expressionId();
|
||||||
CalpontSystemCatalog::ColType ct = rc->resultType();
|
CalpontSystemCatalog::ColType ct = rc->resultType();
|
||||||
tupleKey = getExpTupleKey(jobInfo, eid);
|
tupleKey = getExpTupleKey(jobInfo, eid);
|
||||||
jobInfo.orderByColVec.push_back(make_pair(tupleKey, orderByCols[i]->asc()));
|
jobInfo.orderByColVec.push_back(make_pair(tupleKey, orderByCols[i]->asc()));
|
||||||
|
@ -7791,12 +7791,16 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ordercol->direction == ORDER::ORDER_ASC)
|
SimpleColumn* sc = dynamic_cast<SimpleColumn*>(rc);
|
||||||
rc->asc(true);
|
if (!sc || sc->oid())
|
||||||
else
|
{
|
||||||
rc->asc(false);
|
if (ordercol->direction == ORDER::ORDER_ASC)
|
||||||
|
rc->asc(true);
|
||||||
|
else
|
||||||
|
rc->asc(false);
|
||||||
|
|
||||||
gwi.orderByCols.push_back(SRCP(rc));
|
gwi.orderByCols.push_back(SRCP(rc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// make sure columnmap, returnedcols and count(*) arg_list are not empty
|
// make sure columnmap, returnedcols and count(*) arg_list are not empty
|
||||||
@ -9583,12 +9587,16 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ordercol->direction == ORDER::ORDER_ASC)
|
SimpleColumn* sc = dynamic_cast<SimpleColumn*>(rc);
|
||||||
rc->asc(true);
|
if (!sc || sc->oid())
|
||||||
else
|
{
|
||||||
rc->asc(false);
|
if (ordercol->direction == ORDER::ORDER_ASC)
|
||||||
|
rc->asc(true);
|
||||||
|
else
|
||||||
|
rc->asc(false);
|
||||||
|
|
||||||
gwi.orderByCols.push_back(SRCP(rc));
|
gwi.orderByCols.push_back(SRCP(rc));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user