//===----------------------------------------------------------------------===// // DuckDB // // duckdb/execution/operator/scan/physical_table_scan.hpp // // //===----------------------------------------------------------------------===// #pragma once #include "duckdb/execution/physical_operator.hpp" #include "duckdb/function/table_function.hpp" #include "duckdb/planner/table_filter.hpp" #include "duckdb/storage/data_table.hpp" namespace duckdb { //! Represents a scan of a base table class PhysicalTableScan : public PhysicalOperator { public: static constexpr const PhysicalOperatorType TYPE = PhysicalOperatorType::TABLE_SCAN; public: //! Regular Table Scan PhysicalTableScan(vector types, TableFunction function, unique_ptr bind_data, vector column_ids, vector names, unique_ptr table_filters, idx_t estimated_cardinality); //! Table scan that immediately projects out filter columns that are unused in the remainder of the query plan PhysicalTableScan(vector types, TableFunction function, unique_ptr bind_data, vector returned_types, vector column_ids, vector projection_ids, vector names, unique_ptr table_filters, idx_t estimated_cardinality); //! The table function TableFunction function; //! Bind data of the function unique_ptr bind_data; //! The types of ALL columns that can be returned by the table function vector returned_types; //! The column ids used within the table function vector column_ids; //! The projected-out column ids vector projection_ids; //! The names of the columns vector names; //! The table filters unique_ptr table_filters; public: string GetName() const override; string ParamsToString() const override; bool Equals(const PhysicalOperator &other) const override; public: unique_ptr GetLocalSourceState(ExecutionContext &context, GlobalSourceState &gstate) const override; unique_ptr GetGlobalSourceState(ClientContext &context) const override; SourceResultType GetData(ExecutionContext &context, DataChunk &chunk, OperatorSourceInput &input) const override; idx_t GetBatchIndex(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate, LocalSourceState &lstate) const override; bool IsSource() const override { return true; } bool ParallelSource() const override { return true; } bool SupportsBatchIndex() const override { return function.get_batch_index != nullptr; } double GetProgress(ClientContext &context, GlobalSourceState &gstate) const override; }; } // namespace duckdb