Skip to content

Commit b1384a1

Browse files
authored
refactor: clean TableBuilder in catalog (#366)
1 parent dbcbdf2 commit b1384a1

File tree

6 files changed

+0
-79
lines changed

6 files changed

+0
-79
lines changed

src/iceberg/catalog.h

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -184,64 +184,6 @@ class ICEBERG_EXPORT Catalog {
184184
/// \return a Table instance or ErrorKind::kAlreadyExists if the table already exists
185185
virtual Result<std::shared_ptr<Table>> RegisterTable(
186186
const TableIdentifier& identifier, const std::string& metadata_file_location) = 0;
187-
188-
/// \brief A builder used to create valid tables or start create/replace transactions
189-
class TableBuilder {
190-
public:
191-
virtual ~TableBuilder() = default;
192-
193-
/// \brief Sets a partition spec for the table
194-
///
195-
/// \param spec a partition spec
196-
/// \return this for method chaining
197-
virtual TableBuilder& WithPartitionSpec(const PartitionSpec& spec) = 0;
198-
199-
/// \brief Sets a sort order for the table
200-
///
201-
/// \param sort_order a sort order
202-
/// \return this for method chaining
203-
virtual TableBuilder& WithSortOrder(const SortOrder& sort_order) = 0;
204-
205-
/// \brief Sets a location for the table
206-
///
207-
/// \param location a location
208-
/// \return this for method chaining
209-
virtual TableBuilder& WithLocation(const std::string& location) = 0;
210-
211-
/// \brief Adds key/value properties to the table
212-
///
213-
/// \param properties key/value properties
214-
/// \return this for method chaining
215-
virtual TableBuilder& WithProperties(
216-
const std::unordered_map<std::string, std::string>& properties) = 0;
217-
218-
/// \brief Adds a key/value property to the table
219-
///
220-
/// \param key a key
221-
/// \param value a value
222-
/// \return this for method chaining
223-
virtual TableBuilder& WithProperty(const std::string& key,
224-
const std::string& value) = 0;
225-
226-
/// \brief Creates the table
227-
///
228-
/// \return the created table
229-
virtual std::unique_ptr<Table> Create() = 0;
230-
231-
/// \brief Starts a transaction to create the table
232-
///
233-
/// \return the Transaction to create the table
234-
virtual std::unique_ptr<Transaction> StageCreate() = 0;
235-
};
236-
237-
/// \brief Instantiate a builder to either create a table or start a create/replace
238-
/// transaction
239-
///
240-
/// \param identifier a table identifier
241-
/// \param schema a schema
242-
/// \return the builder to create a table or start a create/replace transaction
243-
virtual std::unique_ptr<TableBuilder> BuildTable(const TableIdentifier& identifier,
244-
const Schema& schema) const = 0;
245187
};
246188

247189
} // namespace iceberg

src/iceberg/catalog/memory/in_memory_catalog.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ Status InMemoryCatalog::DropTable(const TableIdentifier& identifier, bool purge)
417417

418418
Status InMemoryCatalog::RenameTable(const TableIdentifier& from,
419419
const TableIdentifier& to) {
420-
std::unique_lock lock(mutex_);
421420
return NotImplemented("rename table");
422421
}
423422

@@ -454,9 +453,4 @@ Result<std::shared_ptr<Table>> InMemoryCatalog::RegisterTable(
454453
return LoadTable(identifier);
455454
}
456455

457-
std::unique_ptr<Catalog::TableBuilder> InMemoryCatalog::BuildTable(
458-
const TableIdentifier& identifier, const Schema& schema) const {
459-
throw IcebergError("not implemented");
460-
}
461-
462456
} // namespace iceberg

src/iceberg/catalog/memory/in_memory_catalog.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,6 @@ class ICEBERG_EXPORT InMemoryCatalog
9797
const TableIdentifier& identifier,
9898
const std::string& metadata_file_location) override;
9999

100-
std::unique_ptr<TableBuilder> BuildTable(const TableIdentifier& identifier,
101-
const Schema& schema) const override;
102-
103100
private:
104101
std::string catalog_name_;
105102
std::unordered_map<std::string, std::string> properties_;

src/iceberg/catalog/rest/rest_catalog.cc

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,4 @@ Result<std::shared_ptr<Table>> RestCatalog::RegisterTable(
194194
return NotImplemented("Not implemented");
195195
}
196196

197-
std::unique_ptr<RestCatalog::TableBuilder> RestCatalog::BuildTable(
198-
[[maybe_unused]] const TableIdentifier& identifier,
199-
[[maybe_unused]] const Schema& schema) const {
200-
return nullptr;
201-
}
202-
203197
} // namespace iceberg::rest

src/iceberg/catalog/rest/rest_catalog.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ class ICEBERG_REST_EXPORT RestCatalog : public Catalog {
9696
const TableIdentifier& identifier,
9797
const std::string& metadata_file_location) override;
9898

99-
std::unique_ptr<RestCatalog::TableBuilder> BuildTable(
100-
const TableIdentifier& identifier, const Schema& schema) const override;
101-
10299
private:
103100
RestCatalog(std::unique_ptr<RestCatalogProperties> config,
104101
std::unique_ptr<ResourcePaths> paths);

src/iceberg/test/mock_catalog.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ class MockCatalog : public Catalog {
8383

8484
MOCK_METHOD((Result<std::shared_ptr<Table>>), RegisterTable,
8585
(const TableIdentifier&, const std::string&), (override));
86-
87-
MOCK_METHOD((std::unique_ptr<TableBuilder>), BuildTable,
88-
(const TableIdentifier&, const Schema&), (const, override));
8986
};
9087

9188
} // namespace iceberg

0 commit comments

Comments
 (0)