-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathrest_catalog.cc
More file actions
509 lines (446 loc) · 21.6 KB
/
rest_catalog.cc
File metadata and controls
509 lines (446 loc) · 21.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include "iceberg/catalog/rest/rest_catalog.h"
#include <memory>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <nlohmann/json.hpp>
#include "iceberg/catalog/rest/auth/auth_managers.h"
#include "iceberg/catalog/rest/catalog_properties.h"
#include "iceberg/catalog/rest/constant.h"
#include "iceberg/catalog/rest/endpoint.h"
#include "iceberg/catalog/rest/error_handlers.h"
#include "iceberg/catalog/rest/http_client.h"
#include "iceberg/catalog/rest/json_serde_internal.h"
#include "iceberg/catalog/rest/resource_paths.h"
#include "iceberg/catalog/rest/rest_util.h"
#include "iceberg/catalog/rest/types.h"
#include "iceberg/json_serde_internal.h"
#include "iceberg/metrics/metrics_reporters.h"
#include "iceberg/partition_spec.h"
#include "iceberg/result.h"
#include "iceberg/schema.h"
#include "iceberg/sort_order.h"
#include "iceberg/table.h"
#include "iceberg/table_requirement.h"
#include "iceberg/table_update.h"
#include "iceberg/transaction.h"
#include "iceberg/util/macros.h"
namespace iceberg::rest {
namespace {
/// \brief Get the default set of endpoints for backwards compatibility according to the
/// iceberg rest spec.
std::unordered_set<Endpoint> GetDefaultEndpoints() {
return {
Endpoint::ListNamespaces(), Endpoint::GetNamespaceProperties(),
Endpoint::CreateNamespace(), Endpoint::UpdateNamespace(),
Endpoint::DropNamespace(), Endpoint::ListTables(),
Endpoint::LoadTable(), Endpoint::CreateTable(),
Endpoint::UpdateTable(), Endpoint::DeleteTable(),
Endpoint::RenameTable(), Endpoint::RegisterTable(),
Endpoint::ReportMetrics(), Endpoint::CommitTransaction(),
};
}
/// \brief Fetch server configuration from the REST catalog server.
Result<CatalogConfig> FetchServerConfig(const ResourcePaths& paths,
const RestCatalogProperties& current_config,
auth::AuthSession& session) {
ICEBERG_ASSIGN_OR_RAISE(auto config_path, paths.Config());
HttpClient client(current_config.ExtractHeaders());
// Send the client's warehouse location to the service to keep in sync.
// This is needed for cases where the warehouse is configured client side, but may
// be used on the server side, like the Hive Metastore, where both client and service
// may have a warehouse location.
std::unordered_map<std::string, std::string> params;
std::string warehouse = current_config.Get(RestCatalogProperties::kWarehouse);
if (!warehouse.empty()) {
params[RestCatalogProperties::kWarehouse.key()] = std::move(warehouse);
}
ICEBERG_ASSIGN_OR_RAISE(const auto response,
client.Get(config_path, params, /*headers=*/{},
*DefaultErrorHandler::Instance(), session));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(response.body()));
return CatalogConfigFromJson(json);
}
#define ICEBERG_ENDPOINT_CHECK(endpoints, endpoint) \
do { \
if (!endpoints.contains(endpoint)) { \
return NotSupported("Not supported endpoint: {}", endpoint.ToString()); \
} \
} while (0)
Result<bool> CaptureNoSuchObject(const auto& status, ErrorKind kind) {
ICEBERG_DCHECK(kind == ErrorKind::kNoSuchTable || kind == ErrorKind::kNoSuchNamespace,
"Invalid kind for CaptureNoSuchObject");
if (status.has_value()) {
return true;
}
if (status.error().kind == kind) {
return false;
}
return std::unexpected(status.error());
}
Result<bool> CaptureNoSuchTable(const auto& status) {
return CaptureNoSuchObject(status, ErrorKind::kNoSuchTable);
}
Result<bool> CaptureNoSuchNamespace(const auto& status) {
return CaptureNoSuchObject(status, ErrorKind::kNoSuchNamespace);
}
} // namespace
RestCatalog::~RestCatalog() = default;
Result<std::shared_ptr<RestCatalog>> RestCatalog::Make(
const RestCatalogProperties& config, std::shared_ptr<FileIO> file_io) {
ICEBERG_ASSIGN_OR_RAISE(auto uri, config.Uri());
if (!file_io) {
return InvalidArgument("FileIO is required to create RestCatalog");
}
std::string catalog_name = config.Get(RestCatalogProperties::kName);
ICEBERG_ASSIGN_OR_RAISE(auto auth_manager,
auth::AuthManagers::Load(catalog_name, config.configs()));
ICEBERG_ASSIGN_OR_RAISE(
auto paths, ResourcePaths::Make(std::string(TrimTrailingSlash(uri)),
config.Get(RestCatalogProperties::kPrefix)));
// Create init session for fetching server configuration
HttpClient init_client(config.ExtractHeaders());
ICEBERG_ASSIGN_OR_RAISE(auto init_session,
auth_manager->InitSession(init_client, config.configs()));
ICEBERG_ASSIGN_OR_RAISE(auto server_config,
FetchServerConfig(*paths, config, *init_session));
RestCatalogProperties final_config = RestCatalogProperties::FromMap(
MergeConfigs(server_config.defaults, config.configs(), server_config.overrides));
std::unordered_set<Endpoint> endpoints;
if (!server_config.endpoints.empty()) {
// Endpoints are already parsed during JSON deserialization, just convert to set
endpoints = std::unordered_set<Endpoint>(server_config.endpoints.begin(),
server_config.endpoints.end());
} else {
// If a server does not send the endpoints field, use default set of endpoints
// for backwards compatibility with legacy servers
endpoints = GetDefaultEndpoints();
}
// Update resource paths based on the final config
ICEBERG_ASSIGN_OR_RAISE(auto final_uri, final_config.Uri());
ICEBERG_ASSIGN_OR_RAISE(
paths, ResourcePaths::Make(std::string(TrimTrailingSlash(final_uri)),
final_config.Get(RestCatalogProperties::kPrefix)));
// Get snapshot loading mode
ICEBERG_ASSIGN_OR_RAISE(auto snapshot_mode, final_config.SnapshotLoadingMode());
auto client = std::make_unique<HttpClient>(final_config.ExtractHeaders());
ICEBERG_ASSIGN_OR_RAISE(auto catalog_session,
auth_manager->CatalogSession(*client, final_config.configs()));
// Load metrics reporter from catalog properties
std::shared_ptr<MetricsReporter> reporter;
auto reporter_result = MetricsReporters::Load(final_config.configs());
if (reporter_result.has_value()) {
reporter = std::move(reporter_result.value());
}
return std::shared_ptr<RestCatalog>(
new RestCatalog(std::move(final_config), std::move(file_io), std::move(client),
std::move(paths), std::move(endpoints), std::move(auth_manager),
std::move(catalog_session), std::move(reporter), snapshot_mode));
}
RestCatalog::RestCatalog(RestCatalogProperties config, std::shared_ptr<FileIO> file_io,
std::unique_ptr<HttpClient> client,
std::unique_ptr<ResourcePaths> paths,
std::unordered_set<Endpoint> endpoints,
std::unique_ptr<auth::AuthManager> auth_manager,
std::shared_ptr<auth::AuthSession> catalog_session,
std::shared_ptr<MetricsReporter> reporter,
SnapshotMode snapshot_mode)
: config_(std::move(config)),
file_io_(std::move(file_io)),
client_(std::move(client)),
paths_(std::move(paths)),
name_(config_.Get(RestCatalogProperties::kName)),
supported_endpoints_(std::move(endpoints)),
auth_manager_(std::move(auth_manager)),
catalog_session_(std::move(catalog_session)),
reporter_(std::move(reporter)),
snapshot_mode_(snapshot_mode) {
ICEBERG_DCHECK(catalog_session_ != nullptr, "catalog_session must not be null");
}
std::string_view RestCatalog::name() const { return name_; }
Result<std::vector<Namespace>> RestCatalog::ListNamespaces(const Namespace& ns) const {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::ListNamespaces());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Namespaces());
std::vector<Namespace> result;
std::string next_token;
while (true) {
std::unordered_map<std::string, std::string> params;
if (!ns.levels.empty()) {
ICEBERG_ASSIGN_OR_RAISE(params[kQueryParamParent], EncodeNamespace(ns));
}
if (!next_token.empty()) {
params[kQueryParamPageToken] = next_token;
}
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Get(path, params, /*headers=*/{}, *NamespaceErrorHandler::Instance(),
*catalog_session_));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(response.body()));
ICEBERG_ASSIGN_OR_RAISE(auto list_response, ListNamespacesResponseFromJson(json));
result.insert(result.end(), list_response.namespaces.begin(),
list_response.namespaces.end());
if (list_response.next_page_token.empty()) {
return result;
}
next_token = std::move(list_response.next_page_token);
}
return result;
}
Status RestCatalog::CreateNamespace(
const Namespace& ns, const std::unordered_map<std::string, std::string>& properties) {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::CreateNamespace());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Namespaces());
CreateNamespaceRequest request{.namespace_ = ns, .properties = properties};
ICEBERG_ASSIGN_OR_RAISE(auto json_request, ToJsonString(ToJson(request)));
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Post(path, json_request, /*headers=*/{},
*NamespaceErrorHandler::Instance(), *catalog_session_));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(response.body()));
ICEBERG_ASSIGN_OR_RAISE(auto create_response, CreateNamespaceResponseFromJson(json));
return {};
}
Result<std::unordered_map<std::string, std::string>> RestCatalog::GetNamespaceProperties(
const Namespace& ns) const {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::GetNamespaceProperties());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Namespace_(ns));
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Get(path, /*params=*/{}, /*headers=*/{},
*NamespaceErrorHandler::Instance(), *catalog_session_));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(response.body()));
ICEBERG_ASSIGN_OR_RAISE(auto get_response, GetNamespaceResponseFromJson(json));
return get_response.properties;
}
Status RestCatalog::DropNamespace(const Namespace& ns) {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::DropNamespace());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Namespace_(ns));
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Delete(path, /*params=*/{}, /*headers=*/{},
*DropNamespaceErrorHandler::Instance(), *catalog_session_));
return {};
}
Result<bool> RestCatalog::NamespaceExists(const Namespace& ns) const {
if (!supported_endpoints_.contains(Endpoint::NamespaceExists())) {
// Fall back to GetNamespaceProperties
return CaptureNoSuchNamespace(GetNamespaceProperties(ns));
}
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Namespace_(ns));
return CaptureNoSuchNamespace(client_->Head(
path, /*headers=*/{}, *NamespaceErrorHandler::Instance(), *catalog_session_));
}
Status RestCatalog::UpdateNamespaceProperties(
const Namespace& ns, const std::unordered_map<std::string, std::string>& updates,
const std::unordered_set<std::string>& removals) {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::UpdateNamespace());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->NamespaceProperties(ns));
UpdateNamespacePropertiesRequest request{
.removals = std::vector<std::string>(removals.begin(), removals.end()),
.updates = updates};
ICEBERG_ASSIGN_OR_RAISE(auto json_request, ToJsonString(ToJson(request)));
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Post(path, json_request, /*headers=*/{},
*NamespaceErrorHandler::Instance(), *catalog_session_));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(response.body()));
ICEBERG_ASSIGN_OR_RAISE(auto update_response,
UpdateNamespacePropertiesResponseFromJson(json));
return {};
}
Result<std::vector<TableIdentifier>> RestCatalog::ListTables(const Namespace& ns) const {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::ListTables());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Tables(ns));
std::vector<TableIdentifier> result;
std::string next_token;
while (true) {
std::unordered_map<std::string, std::string> params;
if (!next_token.empty()) {
params[kQueryParamPageToken] = next_token;
}
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Get(path, params, /*headers=*/{}, *TableErrorHandler::Instance(),
*catalog_session_));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(response.body()));
ICEBERG_ASSIGN_OR_RAISE(auto list_response, ListTablesResponseFromJson(json));
result.insert(result.end(), list_response.identifiers.begin(),
list_response.identifiers.end());
if (list_response.next_page_token.empty()) {
return result;
}
next_token = std::move(list_response.next_page_token);
}
return result;
}
Result<LoadTableResult> RestCatalog::CreateTableInternal(
const TableIdentifier& identifier, const std::shared_ptr<Schema>& schema,
const std::shared_ptr<PartitionSpec>& spec, const std::shared_ptr<SortOrder>& order,
const std::string& location,
const std::unordered_map<std::string, std::string>& properties, bool stage_create) {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::CreateTable());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Tables(identifier.ns));
CreateTableRequest request{
.name = identifier.name,
.location = location,
.schema = schema,
.partition_spec = spec,
.write_order = order,
.stage_create = stage_create,
.properties = properties,
};
ICEBERG_ASSIGN_OR_RAISE(auto json_request, ToJsonString(ToJson(request)));
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Post(path, json_request, /*headers=*/{}, *TableErrorHandler::Instance(),
*catalog_session_));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(response.body()));
return LoadTableResultFromJson(json);
}
Result<std::shared_ptr<Table>> RestCatalog::CreateTable(
const TableIdentifier& identifier, const std::shared_ptr<Schema>& schema,
const std::shared_ptr<PartitionSpec>& spec, const std::shared_ptr<SortOrder>& order,
const std::string& location,
const std::unordered_map<std::string, std::string>& properties) {
ICEBERG_ASSIGN_OR_RAISE(auto result,
CreateTableInternal(identifier, schema, spec, order, location,
properties, /*stage_create=*/false));
return Table::Make(identifier, std::move(result.metadata),
std::move(result.metadata_location), file_io_, shared_from_this(),
reporter_);
}
Result<std::shared_ptr<Table>> RestCatalog::UpdateTable(
const TableIdentifier& identifier,
const std::vector<std::unique_ptr<TableRequirement>>& requirements,
const std::vector<std::unique_ptr<TableUpdate>>& updates) {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::UpdateTable());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Table(identifier));
CommitTableRequest request{.identifier = identifier};
request.requirements.reserve(requirements.size());
for (const auto& req : requirements) {
request.requirements.push_back(req->Clone());
}
request.updates.reserve(updates.size());
for (const auto& update : updates) {
request.updates.push_back(update->Clone());
}
ICEBERG_ASSIGN_OR_RAISE(auto json_request, ToJsonString(ToJson(request)));
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Post(path, json_request, /*headers=*/{}, *TableErrorHandler::Instance(),
*catalog_session_));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(response.body()));
ICEBERG_ASSIGN_OR_RAISE(auto commit_response, CommitTableResponseFromJson(json));
return Table::Make(identifier, std::move(commit_response.metadata),
std::move(commit_response.metadata_location), file_io_,
shared_from_this(), reporter_);
}
Result<std::shared_ptr<Transaction>> RestCatalog::StageCreateTable(
const TableIdentifier& identifier, const std::shared_ptr<Schema>& schema,
const std::shared_ptr<PartitionSpec>& spec, const std::shared_ptr<SortOrder>& order,
const std::string& location,
const std::unordered_map<std::string, std::string>& properties) {
ICEBERG_ASSIGN_OR_RAISE(auto result,
CreateTableInternal(identifier, schema, spec, order, location,
properties, /*stage_create=*/true));
ICEBERG_ASSIGN_OR_RAISE(auto staged_table,
StagedTable::Make(identifier, std::move(result.metadata),
std::move(result.metadata_location), file_io_,
shared_from_this(), reporter_));
return Transaction::Make(std::move(staged_table), TransactionKind::kCreate);
}
Status RestCatalog::DropTable(const TableIdentifier& identifier, bool purge) {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::DeleteTable());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Table(identifier));
std::unordered_map<std::string, std::string> params;
if (purge) {
params["purgeRequested"] = "true";
}
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Delete(path, params, /*headers=*/{}, *TableErrorHandler::Instance(),
*catalog_session_));
return {};
}
Result<bool> RestCatalog::TableExists(const TableIdentifier& identifier) const {
if (!supported_endpoints_.contains(Endpoint::TableExists())) {
// Fall back to call LoadTable
return CaptureNoSuchTable(LoadTableInternal(identifier));
}
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Table(identifier));
return CaptureNoSuchTable(client_->Head(
path, /*headers=*/{}, *TableErrorHandler::Instance(), *catalog_session_));
}
Status RestCatalog::RenameTable(const TableIdentifier& from, const TableIdentifier& to) {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::RenameTable());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Rename());
RenameTableRequest request{.source = from, .destination = to};
ICEBERG_ASSIGN_OR_RAISE(auto json_request, ToJsonString(ToJson(request)));
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Post(path, json_request, /*headers=*/{}, *TableErrorHandler::Instance(),
*catalog_session_));
return {};
}
Result<std::string> RestCatalog::LoadTableInternal(
const TableIdentifier& identifier) const {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::LoadTable());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Table(identifier));
std::unordered_map<std::string, std::string> params;
if (snapshot_mode_ == SnapshotMode::kRefs) {
params["snapshots"] = "refs";
} else {
params["snapshots"] = "all";
}
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Get(path, params, /*headers=*/{}, *TableErrorHandler::Instance(),
*catalog_session_));
return response.body();
}
Result<std::shared_ptr<Table>> RestCatalog::LoadTable(const TableIdentifier& identifier) {
ICEBERG_ASSIGN_OR_RAISE(const auto body, LoadTableInternal(identifier));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(body));
ICEBERG_ASSIGN_OR_RAISE(auto load_result, LoadTableResultFromJson(json));
return Table::Make(identifier, std::move(load_result.metadata),
std::move(load_result.metadata_location), file_io_,
shared_from_this(), reporter_);
}
Result<std::shared_ptr<Table>> RestCatalog::RegisterTable(
const TableIdentifier& identifier, const std::string& metadata_file_location) {
ICEBERG_ENDPOINT_CHECK(supported_endpoints_, Endpoint::RegisterTable());
ICEBERG_ASSIGN_OR_RAISE(auto path, paths_->Register(identifier.ns));
RegisterTableRequest request{
.name = identifier.name,
.metadata_location = metadata_file_location,
};
ICEBERG_ASSIGN_OR_RAISE(auto json_request, ToJsonString(ToJson(request)));
ICEBERG_ASSIGN_OR_RAISE(
const auto response,
client_->Post(path, json_request, /*headers=*/{}, *TableErrorHandler::Instance(),
*catalog_session_));
ICEBERG_ASSIGN_OR_RAISE(auto json, FromJsonString(response.body()));
ICEBERG_ASSIGN_OR_RAISE(auto load_result, LoadTableResultFromJson(json));
return Table::Make(identifier, std::move(load_result.metadata),
std::move(load_result.metadata_location), file_io_,
shared_from_this(), reporter_);
}
} // namespace iceberg::rest