MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / mapDistinct

Method mapDistinct

src/processor/map/map_distinct.cpp:11–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace processor {
10
11std::unique_ptr<PhysicalOperator> PlanMapper::mapDistinct(const LogicalOperator* logicalOperator) {
12 auto distinct = logicalOperator->constPtrCast<LogicalDistinct>();
13 auto child = distinct->getChild(0).get();
14 auto outSchema = distinct->getSchema();
15 auto inSchema = child->getSchema();
16 auto prevOperator = mapOperator(child);
17 uint64_t limitNum = 0;
18 if (distinct->hasLimitNum()) {
19 limitNum += distinct->getLimitNum();
20 }
21 if (distinct->hasSkipNum()) {
22 limitNum += distinct->getSkipNum();
23 }
24 if (limitNum == 0) {
25 limitNum = UINT64_MAX;
26 }
27 auto op = createDistinctHashAggregate(distinct->getKeys(), distinct->getPayloads(), inSchema,
28 outSchema, std::move(prevOperator));
29 auto hashAggregate = op->getChild(0)->getChild(0)->ptrCast<HashAggregate>();
30 hashAggregate->getSharedState()->setLimitNumber(limitNum);
31 auto printInfo = static_cast<const HashAggregatePrintInfo*>(hashAggregate->getPrintInfo());
32 const_cast<HashAggregatePrintInfo*>(printInfo)->limitNum = limitNum;
33 return op;
34}
35
36} // namespace processor
37} // namespace lbug

Callers

nothing calls this directly

Calls 11

getMethod · 0.45
getChildMethod · 0.45
hasLimitNumMethod · 0.45
getLimitNumMethod · 0.45
hasSkipNumMethod · 0.45
getSkipNumMethod · 0.45
getKeysMethod · 0.45
getPayloadsMethod · 0.45
setLimitNumberMethod · 0.45
getSharedStateMethod · 0.45
getPrintInfoMethod · 0.45

Tested by

no test coverage detected