#pragma once #include "insert_executor.h" #include "processor/operator/physical_operator.h" namespace lbug { namespace processor { struct InsertPrintInfo final : OPPrintInfo { binder::expression_vector expressions; common::ConflictAction action; InsertPrintInfo(binder::expression_vector expressions, common::ConflictAction action) : expressions(std::move(expressions)), action(action) {} std::string toString() const override; std::unique_ptr copy() const override { return std::unique_ptr(new InsertPrintInfo(*this)); } private: InsertPrintInfo(const InsertPrintInfo& other) : OPPrintInfo(other), expressions(other.expressions), action(other.action) {} }; class Insert final : public PhysicalOperator { static constexpr PhysicalOperatorType type_ = PhysicalOperatorType::INSERT; public: Insert(std::vector nodeExecutors, std::vector relExecutors, std::unique_ptr child, uint32_t id, std::unique_ptr printInfo) : PhysicalOperator{type_, std::move(child), id, std::move(printInfo)}, nodeExecutors{std::move(nodeExecutors)}, relExecutors{std::move(relExecutors)} {} bool isParallel() const override { return false; } void initLocalStateInternal(ResultSet* resultSet, ExecutionContext* context) override; bool getNextTuplesInternal(ExecutionContext* context) override; std::unique_ptr copy() override { return std::make_unique(copyVector(nodeExecutors), copyVector(relExecutors), children[0]->copy(), id, printInfo->copy()); } private: std::vector nodeExecutors; std::vector relExecutors; }; } // namespace processor } // namespace lbug