1919
2020#pragma once
2121
22- #include < memory>
23- #include < mutex>
2422#include < string>
2523#include < unordered_map>
2624#include < vector>
2725
2826#include " iceberg/iceberg_export.h"
29- #include " iceberg/location_provider.h"
3027#include " iceberg/result.h"
31- #include " iceberg/table_scan.h"
32- #include " iceberg/transaction.h"
3328#include " iceberg/type_fwd.h"
3429
3530namespace iceberg {
@@ -92,10 +87,11 @@ class ICEBERG_EXPORT Table {
9287 // / \return a vector of history entries
9388 virtual const std::vector<std::shared_ptr<HistoryEntry>>& history () const = 0;
9489
95- // / \brief Create a new table scan for this table
96- // /
97- // / Once a table scan is created, it can be refined to project columns and filter data.
98- virtual Result<std::unique_ptr<TableScan>> NewScan () const = 0;
90+ // TODO(lishuxu): TableScan is not implemented yet, disable it for now.
91+ // /// \brief Create a new table scan for this table
92+ // ///
93+ // /// Once a table scan is created, it can be refined to project columns and filter
94+ // data. virtual Result<std::unique_ptr<TableScan>> NewScan() const = 0;
9995
10096 // / \brief Create a new append API to add files to this table and commit
10197 virtual Result<std::shared_ptr<AppendFiles>> NewAppend () = 0;
@@ -112,100 +108,4 @@ class ICEBERG_EXPORT Table {
112108 virtual Result<std::unique_ptr<LocationProvider>> location_provider () const = 0;
113109};
114110
115- // / \brief An abstract base implementation of the Iceberg Table interface.
116- // /
117- // / BaseTable provides common functionality for Iceberg table implementations,
118- // / including lazy initialization of schema, partition specs, sort orders,
119- // / and snapshot metadata.
120- // /
121- // / This class is not intended to be used directly by users, but serves as a foundation
122- // / for concrete implementations such as StaticTable or CatalogTable.
123- class ICEBERG_EXPORT BaseTable : public Table {
124- public:
125- ~BaseTable () override = default ;
126-
127- BaseTable (std::string name, std::shared_ptr<TableMetadata> metadata);
128-
129- const std::string& name () const override { return name_; }
130-
131- const std::string& uuid () const override ;
132-
133- Result<std::shared_ptr<Schema>> schema () const override ;
134-
135- const std::unordered_map<int32_t , std::shared_ptr<Schema>>& schemas () const override ;
136-
137- Result<std::shared_ptr<PartitionSpec>> spec () const override ;
138-
139- const std::unordered_map<int32_t , std::shared_ptr<PartitionSpec>>& specs ()
140- const override ;
141-
142- Result<std::shared_ptr<SortOrder>> sort_order () const override ;
143-
144- const std::unordered_map<int32_t , std::shared_ptr<SortOrder>>& sort_orders ()
145- const override ;
146-
147- const std::unordered_map<std::string, std::string>& properties () const override ;
148-
149- const std::string& location () const override ;
150-
151- Result<std::shared_ptr<Snapshot>> current_snapshot () const override ;
152-
153- Result<std::shared_ptr<Snapshot>> snapshot (int64_t snapshot_id) const override ;
154-
155- const std::vector<std::shared_ptr<Snapshot>>& snapshots () const override ;
156-
157- const std::vector<std::shared_ptr<HistoryEntry>>& history () const override ;
158-
159- private:
160- void InitSchema () const ;
161- void InitPartitionSpec () const ;
162- void InitSortOrder () const ;
163- void InitSnapshot () const ;
164-
165- const std::string name_;
166-
167- mutable std::shared_ptr<Schema> schema_;
168- mutable std::unordered_map<int32_t , std::shared_ptr<Schema>> schemas_map_;
169-
170- mutable std::shared_ptr<PartitionSpec> partition_spec_;
171- mutable std::unordered_map<int32_t , std::shared_ptr<PartitionSpec>> partition_spec_map_;
172-
173- mutable std::shared_ptr<SortOrder> sort_order_;
174- mutable std::unordered_map<int32_t , std::shared_ptr<SortOrder>> sort_orders_map_;
175-
176- mutable std::shared_ptr<Snapshot> current_snapshot_;
177- mutable std::unordered_map<int64_t , std::shared_ptr<Snapshot>> snapshots_map_;
178-
179- mutable std::vector<std::shared_ptr<HistoryEntry>> history_;
180-
181- std::shared_ptr<TableMetadata> metadata_;
182-
183- // once_flags
184- mutable std::once_flag init_schema_once_;
185- mutable std::once_flag init_partition_spec_once_;
186- mutable std::once_flag init_sort_order_once_;
187- mutable std::once_flag init_snapshot_once_;
188- };
189-
190- // / \brief A read-only implementation of an Iceberg table.
191- // /
192- // / StaticTable represents a snapshot of a table that does not support mutation.
193- class ICEBERG_EXPORT StaticTable : public BaseTable {
194- public:
195- ~StaticTable () override = default ;
196-
197- StaticTable (std::string name, std::shared_ptr<TableMetadata> metadata)
198- : BaseTable(std::move(name), std::move(metadata)) {}
199-
200- Status Refresh () override ;
201-
202- Result<std::unique_ptr<TableScan>> NewScan () const override ;
203-
204- Result<std::shared_ptr<AppendFiles>> NewAppend () override ;
205-
206- Result<std::unique_ptr<Transaction>> NewTransaction () override ;
207-
208- Result<std::unique_ptr<LocationProvider>> location_provider () const override ;
209- };
210-
211111} // namespace iceberg
0 commit comments