//===----------------------------------------------------------------------===// // DuckDB // // duckdb/execution/operator/persistent/physical_batch_insert.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/execution/operator/persistent/physical_insert.hpp" namespace duckdb { class PhysicalBatchInsert : public PhysicalOperator { public: static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::BATCH_INSERT; public: //! INSERT INTO PhysicalBatchInsert(vector types, TableCatalogEntry &table, physical_index_vector_t column_index_map, vector> bound_defaults, idx_t estimated_cardinality); //! CREATE TABLE AS PhysicalBatchInsert(LogicalOperator &op, SchemaCatalogEntry &schema, unique_ptr info, idx_t estimated_cardinality); //! The map from insert column index to table column index physical_index_vector_t column_index_map; //! The table to insert into optional_ptr insert_table; //! The insert types vector insert_types; //! The default expressions of the columns for which no value is provided vector> bound_defaults; //! Table schema, in case of CREATE TABLE AS optional_ptr schema; //! Create table info, in case of CREATE TABLE AS unique_ptr info; // Which action to perform on conflict OnConflictAction action_type; public: // Source interface SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override; bool IsSource() const override { return true; } public: // Sink interface unique_ptr GetGlobalSinkState(ClientContext &context) const override; unique_ptr GetLocalSinkState(ExecutionContext &context) const override; void NextBatch(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate_p) const override; SinkResultType Sink(ExecutionContext &context, DataChunk &chunk, OperatorSinkInput &input) const override; void Combine(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate) const override; SinkFinalizeType Finalize(Pipeline &pipeline, Event &event, ClientContext &context, GlobalSinkState &gstate) const override; bool RequiresBatchIndex() const override { return true; } bool IsSink() const override { return true; } bool ParallelSink() const override { return true; } }; } // namespace duckdb