Skip to content

Commit 45d712f

Browse files
committed
get rid of manifests per Fokko's suggestion
1 parent a9c69fb commit 45d712f

File tree

3 files changed

+14
-66
lines changed

3 files changed

+14
-66
lines changed

src/iceberg/snapshot.cc

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ const std::string SnapshotSummaryFields::kAddedPosDeleteFiles =
3434
"added-position-delete-files";
3535
const std::string SnapshotSummaryFields::kRemovedPosDeleteFiles =
3636
"removed-position-delete-files";
37-
const std::string SnapshotSummaryFields::kAddedDVS = "added-dvs";
38-
const std::string SnapshotSummaryFields::kRemovedDVS = "removed-dvs";
37+
const std::string SnapshotSummaryFields::kAddedDVs = "added-dvs";
38+
const std::string SnapshotSummaryFields::kRemovedDVs = "removed-dvs";
3939
const std::string SnapshotSummaryFields::kRemovedDeleteFiles = "removed-delete-files";
4040
const std::string SnapshotSummaryFields::kTotalDeleteFiles = "total-delete-files";
4141
const std::string SnapshotSummaryFields::kAddedRecords = "added-records";
@@ -69,34 +69,6 @@ std::optional<std::string_view> Snapshot::operation() const {
6969
return std::nullopt;
7070
}
7171

72-
std::optional<std::reference_wrapper<const ManifestList>> Snapshot::ManifestList() const {
73-
return std::visit(
74-
[&](const auto& manifest_list)
75-
-> std::optional<std::reference_wrapper<const struct ManifestList>> {
76-
using T = std::decay_t<decltype(manifest_list)>;
77-
if constexpr (std::is_same_v<T, struct ManifestList>) {
78-
return std::cref(manifest_list);
79-
} else {
80-
return std::nullopt;
81-
}
82-
},
83-
manifest_list);
84-
}
85-
86-
std::optional<std::reference_wrapper<const Manifests>> Snapshot::Manifests() const {
87-
return std::visit(
88-
[&](const auto& manifest_list)
89-
-> std::optional<std::reference_wrapper<const struct Manifests>> {
90-
using T = std::decay_t<decltype(manifest_list)>;
91-
if constexpr (std::is_same_v<T, struct Manifests>) {
92-
return std::cref(manifest_list);
93-
} else {
94-
return std::nullopt;
95-
}
96-
},
97-
manifest_list);
98-
}
99-
10072
bool Snapshot::Equals(const Snapshot& other) const {
10173
if (this == &other) {
10274
return true;

src/iceberg/snapshot.h

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ struct SnapshotSummaryFields {
8585
/// \brief Number of position delete files removed in the snapshot
8686
static const std::string kRemovedPosDeleteFiles;
8787
/// \brief Number of deletion vectors added in the snapshot
88-
static const std::string kAddedDVS;
88+
static const std::string kAddedDVs;
8989
/// \brief Number of deletion vectors removed in the snapshot
90-
static const std::string kRemovedDVS;
90+
static const std::string kRemovedDVs;
9191
/// \brief Number of positional/equality delete files and deletion vectors removed in
9292
/// the snapshot
9393
static const std::string kRemovedDeleteFiles;
@@ -157,17 +157,6 @@ struct ICEBERG_EXPORT DataOperation {
157157
static constexpr std::string kDelete = "delete";
158158
};
159159

160-
/// \brief The location of a manifest list for this snapshot that tracks manifest files
161-
/// with additional metadata
162-
struct ICEBERG_EXPORT ManifestList {
163-
std::string manifest_list_path;
164-
};
165-
166-
/// \brief A list of manifest file locations.
167-
struct ICEBERG_EXPORT Manifests {
168-
std::vector<std::string> manifest_paths;
169-
};
170-
171160
/// \brief A snapshot of the data in a table at a point in time.
172161
///
173162
/// A snapshot consist of one or more file manifests, and the complete table contents is
@@ -185,8 +174,8 @@ struct ICEBERG_EXPORT Snapshot {
185174
/// inspection.
186175
int64_t timestamp_ms;
187176
/// The location of a manifest list for this snapshot that tracks manifest files with
188-
/// additional metadata(v2) or a list of manifest file locations(v1).
189-
std::variant<std::monostate, ManifestList, Manifests> manifest_list;
177+
/// additional metadata.
178+
std::string manifest_list;
190179
/// A string map that summaries the snapshot changes, including operation.
191180
std::unordered_map<std::string, std::string> summary;
192181
/// ID of the table's current schema when the snapshot was created.
@@ -199,18 +188,6 @@ struct ICEBERG_EXPORT Snapshot {
199188
/// unknown.
200189
std::optional<std::string_view> operation() const;
201190

202-
/// \brief Get the manifest list for this snapshot.
203-
///
204-
/// \return the manifest list for this snapshot, or nullopt if the snapshot has no
205-
/// manifest list.
206-
std::optional<std::reference_wrapper<const ManifestList>> ManifestList() const;
207-
208-
/// \brief Get the manifests for this snapshot.
209-
///
210-
/// \return the manifests for this snapshot, or nullopt if the snapshot has no
211-
/// manifests.
212-
std::optional<std::reference_wrapper<const Manifests>> Manifests() const;
213-
214191
/// \brief Compare two snapshots for equality.
215192
friend bool operator==(const Snapshot& lhs, const Snapshot& rhs) {
216193
return lhs.Equals(rhs);

test/snapshot_test.cc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ TEST_F(SnapshotTest, ConstructionAndFieldAccess) {
4848
.parent_snapshot_id = 54321,
4949
.sequence_number = 1,
5050
.timestamp_ms = 1615569200000,
51-
.manifest_list = ManifestList("s3://example/manifest_list.avro"),
51+
.manifest_list = "s3://example/manifest_list.avro",
5252
.summary = summary1,
5353
.schema_id = 10};
5454

@@ -57,8 +57,7 @@ TEST_F(SnapshotTest, ConstructionAndFieldAccess) {
5757
EXPECT_EQ(*snapshot.parent_snapshot_id, 54321);
5858
EXPECT_EQ(snapshot.sequence_number, 1);
5959
EXPECT_EQ(snapshot.timestamp_ms, 1615569200000);
60-
EXPECT_EQ(snapshot.ManifestList()->get().manifest_list_path,
61-
"s3://example/manifest_list.avro");
60+
EXPECT_EQ(snapshot.manifest_list, "s3://example/manifest_list.avro");
6261
EXPECT_EQ(snapshot.operation().value(), DataOperation::kAppend);
6362
EXPECT_EQ(snapshot.summary.at(std::string(SnapshotSummaryFields::kAddedDataFiles)),
6463
"101");
@@ -70,14 +69,14 @@ TEST_F(SnapshotTest, ConstructionAndFieldAccess) {
7069

7170
TEST_F(SnapshotTest, EqualityComparison) {
7271
// Test the == and != operators
73-
Snapshot snapshot1(12345, {}, 1, 1615569200000,
74-
ManifestList("s3://example/manifest_list.avro"), summary1, {});
72+
Snapshot snapshot1(12345, {}, 1, 1615569200000, "s3://example/manifest_list.avro",
73+
summary1, {});
7574

76-
Snapshot snapshot2(12345, {}, 1, 1615569200000,
77-
ManifestList("s3://example/manifest_list.avro"), summary2, {});
75+
Snapshot snapshot2(12345, {}, 1, 1615569200000, "s3://example/manifest_list.avro",
76+
summary2, {});
7877

79-
Snapshot snapshot3(67890, {}, 1, 1615569200000,
80-
ManifestList("s3://example/manifest_list.avro"), summary3, {});
78+
Snapshot snapshot3(67890, {}, 1, 1615569200000, "s3://example/manifest_list.avro",
79+
summary3, {});
8180

8281
EXPECT_EQ(snapshot1, snapshot2);
8382
EXPECT_NE(snapshot1, snapshot3);

0 commit comments

Comments
 (0)