1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-12-21 13:40:58 +03:00

Merge pull request #849 from tntnatbry/limit-fix

Fix limit processing.
This commit is contained in:
Andrew Hutchings
2019-09-02 06:55:41 +01:00
committed by GitHub
3 changed files with 20 additions and 42 deletions

View File

@@ -767,10 +767,6 @@ int doFromSubquery(CalpontExecutionPlan* ep, const string& alias, const string&
void addOrderByAndLimit(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo)
{
// make sure there is a LIMIT
if (csep->orderByCols().size() > 0 && csep->limitNum() == (uint64_t) - 1)
return;
jobInfo.limitStart = csep->limitStart();
jobInfo.limitCount = csep->limitNum();

View File

@@ -1712,9 +1712,6 @@ void parseExecutionPlan(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo,
void makeVtableModeSteps(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo,
JobStepVector& querySteps, JobStepVector& projectSteps, DeliveredTableMap& deliverySteps)
{
// @bug4848, enhance and unify limit handling.
if (csep->limitNum() != (uint64_t) - 1)
{
// special case for outer query order by limit -- return all
if (jobInfo.subId == 0 && csep->hasOrderBy() && !csep->specHandlerProcessed())
{
@@ -1735,8 +1732,6 @@ void makeVtableModeSteps(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo,
jobInfo.limitCount = csep->limitNum();
}
}
// Bug 2123. Added overrideLargeSideEstimate parm below. True if the query was written
// with a hint telling us to skip the estimatation process for determining the large side
// table and instead use the table order in the from clause.

View File

@@ -7842,26 +7842,13 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex,
}
}
// relate to bug4848. let mysql drive limit when limit session variable set.
// do not set in csep. @bug5096. ignore session limit setting for dml
if (gwi.thd->variables.select_limit == (uint64_t) - 1 &&
!csep->hasOrderBy())
{
csep->limitStart(limitOffset);
csep->limitNum(limitNum);
}
// Pushdown queries w ORDER BY and LIMIT
else if (isPushdownHand && csep->hasOrderBy())
// If an explicit limit is not specified, use the system variable value
else
{
csep->limitStart(limitOffset);
csep->limitNum(limitNum);
}
}
// Pushdown queries with ORDER BY w/o explicit limit
else if (isPushdownHand && csep->hasOrderBy())
{
// We must set this to activate LimitedOrderBy in ExeMgr
csep->limitNum((uint64_t) - 2);
csep->limitNum(gwi.thd->variables.select_limit);
}
// We don't currently support limit with correlated subquery