Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MCOL-1052 CS group_by_handler now uses CS internal sorting.
  • Loading branch information
drrtuy committed Apr 16, 2018
1 parent 720e1d9 commit 5d48ddb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions dbcon/joblist/jlf_subquery.cpp
Expand Up @@ -751,8 +751,8 @@ 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;
// if (csep->orderByCols().size() > 0 csep->limitNum() == (uint64_t) - 1)
// return;

jobInfo.limitStart = csep->limitStart();
jobInfo.limitCount = csep->limitNum();
Expand Down
16 changes: 8 additions & 8 deletions dbcon/joblist/jlf_tuplejoblist.cpp
Expand Up @@ -483,28 +483,28 @@ void adjustLastStep(JobStepVector& querySteps, DeliveredTableMap& deliverySteps,
deliverySteps[CNX_VTABLE_ID] = ws;
}

if ((jobInfo.limitCount != (uint64_t) - 1) ||
(jobInfo.constantCol == CONST_COL_EXIST) ||
(jobInfo.hasDistinct))
{
// if ((jobInfo.limitCount != (uint64_t) - 1) ||
// (jobInfo.constantCol == CONST_COL_EXIST) ||
// (jobInfo.hasDistinct))
// {
if (jobInfo.annexStep.get() == NULL)
jobInfo.annexStep.reset(new TupleAnnexStep(jobInfo));

TupleAnnexStep* tas = dynamic_cast<TupleAnnexStep*>(jobInfo.annexStep.get());
tas->setLimit(jobInfo.limitStart, jobInfo.limitCount);

if (jobInfo.limitCount != (uint64_t) - 1)
{
// if (jobInfo.limitCount != (uint64_t) - 1)
// {
if (jobInfo.orderByColVec.size() > 0)
tas->addOrderBy(new LimitedOrderBy());
}
// }

if (jobInfo.constantCol == CONST_COL_EXIST)
tas->addConstant(new TupleConstantStep(jobInfo));

if (jobInfo.hasDistinct)
tas->setDistinct();
}
// }

if (jobInfo.annexStep)
{
Expand Down
2 changes: 1 addition & 1 deletion dbcon/joblist/joblistfactory.cpp
Expand Up @@ -1622,7 +1622,7 @@ void makeVtableModeSteps(CalpontSelectExecutionPlan* csep, JobInfo& jobInfo,
JobStepVector& querySteps, JobStepVector& projectSteps, DeliveredTableMap& deliverySteps)
{
// @bug4848, enhance and unify limit handling.
if (csep->limitNum() != (uint64_t) - 1)
// if (csep->limitNum() != (uint64_t) - 1)
{
// special case for outer query order by limit -- return all
if (jobInfo.subId == 0 && csep->hasOrderBy())
Expand Down
12 changes: 10 additions & 2 deletions dbcon/joblist/limitedorderby.cpp
Expand Up @@ -76,7 +76,13 @@ void LimitedOrderBy::initialize(const RowGroup& rg, const JobInfo& jobInfo)
{
map<uint32_t, uint32_t>::iterator j = keyToIndexMap.find(i->first);
idbassert(j != keyToIndexMap.end());
fOrderByCond.push_back(IdbSortSpec(j->second, i->second));
// MCOL-1052 Ordering direction in CSEP differs from
// internal direction representation.
if (i->second)
fOrderByCond.push_back(IdbSortSpec(j->second, false));
else
fOrderByCond.push_back(IdbSortSpec(j->second, true));
//fOrderByCond.push_back(IdbSortSpec(j->second, i->second));
}

// limit row count info
Expand Down Expand Up @@ -174,7 +180,9 @@ void LimitedOrderBy::finalize()
if (fRowGroup.getRowCount() > 0)
fDataQueue.push(fData);

if (fStart != 0)
// MCOL-1052 The removed check effectivly disables sorting to happen,
// since fStart = 0;
if (true)
{
uint64_t newSize = fRowsPerRG * fRowGroup.getRowSize();
fMemSize += newSize;
Expand Down
3 changes: 0 additions & 3 deletions dbcon/mysql/CMakeLists.txt
Expand Up @@ -20,9 +20,6 @@ SET ( libcalmysql_SRCS
ha_pseudocolumn.cpp)

add_definitions(-DMYSQL_DYNAMIC_PLUGIN)
add_definitions(-DDEBUG_WALK_COND=1)
add_definitions(-DINFINIDB_DEBUG=1)
#add_definitions(-DOUTER_JOIN_DEBUG)

set_source_files_properties(ha_calpont.cpp PROPERTIES COMPILE_FLAGS "-fno-rtti -fno-implicit-templates")

Expand Down

0 comments on commit 5d48ddb

Please sign in to comment.