1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/planner/operator/logical_get.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/function/table_function.hpp"
12#include "duckdb/planner/logical_operator.hpp"
13#include "duckdb/planner/table_filter.hpp"
14
15namespace duckdb {
16
17//! LogicalGet represents a scan operation from a data source
18class LogicalGet : public LogicalOperator {
19public:
20 static constexpr const LogicalOperatorType TYPE = LogicalOperatorType::LOGICAL_GET;
21
22public:
23 LogicalGet(idx_t table_index, TableFunction function, unique_ptr<FunctionData> bind_data,
24 vector<LogicalType> returned_types, vector<string> returned_names);
25
26 //! The table index in the current bind context
27 idx_t table_index;
28 //! The function that is called
29 TableFunction function;
30 //! The bind data of the function
31 unique_ptr<FunctionData> bind_data;
32 //! The types of ALL columns that can be returned by the table function
33 vector<LogicalType> returned_types;
34 //! The names of ALL columns that can be returned by the table function
35 vector<string> names;
36 //! Bound column IDs
37 vector<column_t> column_ids;
38 //! Columns that are used outside of the scan
39 vector<idx_t> projection_ids;
40 //! Filters pushed down for table scan
41 TableFilterSet table_filters;
42 //! The set of input parameters for the table function
43 vector<Value> parameters;
44 //! The set of named input parameters for the table function
45 named_parameter_map_t named_parameters;
46 //! The set of named input table types for the table-in table-out function
47 vector<LogicalType> input_table_types;
48 //! The set of named input table names for the table-in table-out function
49 vector<string> input_table_names;
50 //! For a table-in-out function, the set of projected input columns
51 vector<column_t> projected_input;
52
53 string GetName() const override;
54 string ParamsToString() const override;
55 //! Returns the underlying table that is being scanned, or nullptr if there is none
56 optional_ptr<TableCatalogEntry> GetTable() const;
57
58public:
59 vector<ColumnBinding> GetColumnBindings() override;
60 idx_t EstimateCardinality(ClientContext &context) override;
61
62 void Serialize(FieldWriter &writer) const override;
63 static unique_ptr<LogicalOperator> Deserialize(LogicalDeserializationState &state, FieldReader &reader);
64 vector<idx_t> GetTableIndex() const override;
65 //! Skips the serialization check in VerifyPlan
66 bool SupportSerialization() const override {
67 return function.verify_serialization;
68 };
69
70protected:
71 void ResolveTypes() override;
72};
73} // namespace duckdb
74