| 9 | namespace processor { |
| 10 | |
| 11 | std::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 |
nothing calls this directly
no test coverage detected