Skip to content

Commit d8a7d6c

Browse files
Sandeep GottimukkalaSandeep Gottimukkala
authored andcommitted
Fix API compatibility after rebase on main
Upstream changed Table and DataTableScanBuilder constructors to require full_name/table_name and MetricsReporter parameters. Updated RestTable, RestTableScanBuilder, and their callers accordingly.
1 parent c86e527 commit d8a7d6c

6 files changed

Lines changed: 30 additions & 10 deletions

File tree

‎src/iceberg/catalog/rest/rest_catalog.cc‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,8 @@ Result<std::shared_ptr<Table>> RestCatalog::MakeTableFromLoadResult(
937937
};
938938
return RestTable::Make(identifier, std::move(result.metadata),
939939
std::move(result.metadata_location), std::move(table_io),
940-
std::move(table_catalog), std::move(rest_ctx));
940+
std::move(table_catalog), RestTableName(name_, identifier),
941+
reporter, std::move(rest_ctx));
941942
}
942943

943944
return Table::Make(identifier, std::move(result.metadata),

‎src/iceberg/catalog/rest/rest_table.cc‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ namespace iceberg::rest {
3131

3232
RestTable::RestTable(TableIdentifier identifier, std::shared_ptr<TableMetadata> metadata,
3333
std::string metadata_location, std::shared_ptr<FileIO> io,
34-
std::shared_ptr<Catalog> catalog, RestScanContext rest_context)
34+
std::shared_ptr<Catalog> catalog, std::string full_name,
35+
std::shared_ptr<MetricsReporter> reporter,
36+
RestScanContext rest_context)
3537
: Table(std::move(identifier), std::move(metadata), std::move(metadata_location),
36-
std::move(io), std::move(catalog)),
38+
std::move(io), std::move(catalog), std::move(full_name),
39+
std::move(reporter)),
3740
rest_context_(std::move(rest_context)) {}
3841

3942
RestTable::~RestTable() = default;
@@ -43,18 +46,21 @@ Result<std::shared_ptr<RestTable>> RestTable::Make(TableIdentifier identifier,
4346
std::string metadata_location,
4447
std::shared_ptr<FileIO> io,
4548
std::shared_ptr<Catalog> catalog,
49+
std::string full_name,
50+
std::shared_ptr<MetricsReporter> reporter,
4651
RestScanContext rest_context) {
4752
if (metadata == nullptr) {
4853
return InvalidArgument("Metadata cannot be null");
4954
}
5055
return std::shared_ptr<RestTable>(
5156
new RestTable(std::move(identifier), std::move(metadata),
5257
std::move(metadata_location), std::move(io), std::move(catalog),
53-
std::move(rest_context)));
58+
std::move(full_name), std::move(reporter), std::move(rest_context)));
5459
}
5560

5661
Result<std::unique_ptr<DataTableScanBuilder>> RestTable::NewScan() const {
57-
return std::make_unique<RestTableScanBuilder>(metadata_, io_, rest_context_);
62+
return std::make_unique<RestTableScanBuilder>(metadata_, io_, full_name_, reporter_,
63+
rest_context_);
5864
}
5965

6066
} // namespace iceberg::rest

‎src/iceberg/catalog/rest/rest_table.h‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include "iceberg/catalog/rest/iceberg_rest_export.h"
2626
#include "iceberg/catalog/rest/rest_table_scan.h"
27+
#include "iceberg/metrics/metrics_reporter.h"
2728
#include "iceberg/result.h"
2829
#include "iceberg/table.h"
2930
#include "iceberg/type_fwd.h"
@@ -42,6 +43,8 @@ class ICEBERG_REST_EXPORT RestTable final : public Table {
4243
std::string metadata_location,
4344
std::shared_ptr<FileIO> io,
4445
std::shared_ptr<Catalog> catalog,
46+
std::string full_name,
47+
std::shared_ptr<MetricsReporter> reporter,
4548
RestScanContext rest_context);
4649

4750
~RestTable() override;
@@ -53,7 +56,8 @@ class ICEBERG_REST_EXPORT RestTable final : public Table {
5356
private:
5457
RestTable(TableIdentifier identifier, std::shared_ptr<TableMetadata> metadata,
5558
std::string metadata_location, std::shared_ptr<FileIO> io,
56-
std::shared_ptr<Catalog> catalog, RestScanContext rest_context);
59+
std::shared_ptr<Catalog> catalog, std::string full_name,
60+
std::shared_ptr<MetricsReporter> reporter, RestScanContext rest_context);
5761

5862
RestScanContext rest_context_;
5963
};

‎src/iceberg/catalog/rest/rest_table_scan.cc‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,11 @@ void RestTableScan::CancelPlanning(const std::string& plan_id) const {
262262

263263
RestTableScanBuilder::RestTableScanBuilder(std::shared_ptr<TableMetadata> metadata,
264264
std::shared_ptr<FileIO> io,
265+
std::string table_name,
266+
std::shared_ptr<MetricsReporter> metrics_reporter,
265267
RestScanContext rest_context)
266-
: DataTableScanBuilder(std::move(metadata), std::move(io)),
268+
: DataTableScanBuilder(std::move(metadata), std::move(io), std::move(table_name),
269+
std::move(metrics_reporter)),
267270
rest_context_(std::move(rest_context)) {}
268271

269272
Result<std::unique_ptr<DataTableScan>> RestTableScanBuilder::Build() {

‎src/iceberg/catalog/rest/rest_table_scan.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include "iceberg/catalog/rest/endpoint.h"
2929
#include "iceberg/catalog/rest/iceberg_rest_export.h"
30+
#include "iceberg/metrics/metrics_reporter.h"
3031
#include "iceberg/result.h"
3132
#include "iceberg/table_identifier.h"
3233
#include "iceberg/table_scan.h"
@@ -104,6 +105,8 @@ class ICEBERG_REST_EXPORT RestTableScan : public DataTableScan {
104105
class ICEBERG_REST_EXPORT RestTableScanBuilder : public DataTableScanBuilder {
105106
public:
106107
RestTableScanBuilder(std::shared_ptr<TableMetadata> metadata, std::shared_ptr<FileIO> io,
108+
std::string table_name,
109+
std::shared_ptr<MetricsReporter> metrics_reporter,
107110
RestScanContext rest_context);
108111

109112
/// \brief Resolves schema/context via parent logic then creates a RestTableScan.

‎src/iceberg/test/rest_table_scan_test.cc‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,8 @@ TEST_F(RestTableScanTest, FetchScanTasksEndpointNotSupported) {
372372
// --------------------------------------------------------------------------
373373
TEST_F(RestTableScanTest, UseSnapshotPropagatesUseSnapshotSchemaInContext) {
374374
constexpr int64_t kSnapshotId = 1000L;
375-
RestTableScanBuilder builder(metadata_, file_io_, MakeContext(std::nullopt));
375+
RestTableScanBuilder builder(metadata_, file_io_, "test.my_table", nullptr,
376+
MakeContext(std::nullopt));
376377
builder.UseSnapshot(kSnapshotId);
377378
ICEBERG_UNWRAP_OR_FAIL(auto scan, builder.Build());
378379
EXPECT_TRUE(scan->context().use_snapshot_schema);
@@ -382,7 +383,8 @@ TEST_F(RestTableScanTest, UseSnapshotPropagatesUseSnapshotSchemaInContext) {
382383
// use_snapshot_schema: default scan does not set use_snapshot_schema.
383384
// --------------------------------------------------------------------------
384385
TEST_F(RestTableScanTest, DefaultScanDoesNotSetUseSnapshotSchema) {
385-
RestTableScanBuilder builder(metadata_, file_io_, MakeContext(std::nullopt));
386+
RestTableScanBuilder builder(metadata_, file_io_, "test.my_table", nullptr,
387+
MakeContext(std::nullopt));
386388
ICEBERG_UNWRAP_OR_FAIL(auto scan, builder.Build());
387389
EXPECT_FALSE(scan->context().use_snapshot_schema);
388390
}
@@ -394,7 +396,8 @@ TEST_F(RestTableScanTest, RestTableNewScanReturnsRestTableScanBuilder) {
394396
ICEBERG_UNWRAP_OR_FAIL(
395397
auto table,
396398
RestTable::Make(identifier_, metadata_, "/tmp/metadata.json", file_io_,
397-
/*catalog=*/nullptr, MakeContext(std::nullopt)));
399+
/*catalog=*/nullptr, "test.my_table", nullptr,
400+
MakeContext(std::nullopt)));
398401
ICEBERG_UNWRAP_OR_FAIL(auto builder, table->NewScan());
399402
auto* typed = dynamic_cast<RestTableScanBuilder*>(builder.get());
400403
EXPECT_NE(typed, nullptr);

0 commit comments

Comments
 (0)