Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 10 additions & 22 deletions src/iceberg/test/fast_append_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#include "iceberg/exception.h"
#include "iceberg/expression/expressions.h"
#include "iceberg/manifest/manifest_entry.h"
#include "iceberg/manifest/manifest_reader.h"
#include "iceberg/manifest/manifest_writer.h"
#include "iceberg/metrics/commit_report.h"
#include "iceberg/metrics/metrics_reporter.h"
Expand Down Expand Up @@ -175,14 +174,6 @@ class FastAppendTest : public UpdateTestBase {
return std::vector<ManifestFile>(manifests.begin(), manifests.end());
}

Result<std::vector<ManifestEntry>> ReadEntries(const ManifestFile& manifest) {
ICEBERG_ASSIGN_OR_RAISE(
auto spec, table_->metadata()->PartitionSpecById(manifest.partition_spec_id));
ICEBERG_ASSIGN_OR_RAISE(auto reader,
ManifestReader::Make(manifest, file_io_, schema_, spec));
return reader->Entries();
}

std::shared_ptr<PartitionSpec> spec_;
std::shared_ptr<Schema> schema_;
std::shared_ptr<DataFile> file_a_;
Expand Down Expand Up @@ -292,7 +283,7 @@ TEST_F(FastAppendTest, WriteManifestGroups) {
ASSERT_TRUE(manifests[group_index].added_files_count.has_value());
EXPECT_EQ(manifests[group_index].added_files_count.value(), kGroupSize);

ICEBERG_UNWRAP_OR_FAIL(auto entries, ReadEntries(manifests[group_index]));
ICEBERG_UNWRAP_OR_FAIL(auto entries, ReadManifestEntries(manifests[group_index]));
ASSERT_EQ(entries.size(), kGroupSize);
const size_t offset = group_index * kGroupSize;
for (size_t entry_index = 0; entry_index < entries.size(); ++entry_index) {
Expand Down Expand Up @@ -457,10 +448,7 @@ TEST_F(FastAppendTest, RebaseCopiesAppendManifestAgain) {
EXPECT_THAT(attempt_manifests, ::testing::Not(::testing::Contains(manifest_path)));
attempt_manifests.push_back(manifest_path);
attempt_lists.push_back(snapshot->manifest_list);
ICEBERG_UNWRAP_OR_FAIL(auto entries, ReadEntries(manifests[0]));
ASSERT_THAT(entries, ::testing::SizeIs(1));
ASSERT_NE(entries[0].data_file, nullptr);
EXPECT_EQ(entries[0].data_file->file_path, file_a_->file_path);
ExpectManifestEntries(manifests[0], {file_a_->file_path}, {ManifestStatus::kAdded});
});
ICEBERG_UNWRAP_OR_FAIL(txn, table_->NewTransaction());
ICEBERG_UNWRAP_OR_FAIL(auto fast_append, txn->NewFastAppend());
Expand Down Expand Up @@ -511,10 +499,10 @@ TEST_F(FastAppendTest, AppendManifestWithSnapshotIdInheritance) {
ASSERT_THAT(manifests, ::testing::SizeIs(1));
EXPECT_EQ(manifests[0].manifest_path, path);
EXPECT_EQ(manifests[0].added_snapshot_id, snapshot->snapshot_id);
ICEBERG_UNWRAP_OR_FAIL(auto entries, ReadEntries(manifests[0]));
ASSERT_THAT(entries, ::testing::SizeIs(2));
EXPECT_EQ(entries[0].snapshot_id, snapshot->snapshot_id);
EXPECT_EQ(entries[1].snapshot_id, snapshot->snapshot_id);
ExpectManifestEntriesWithSnapshotIds(manifests[0],
{file_a_->file_path, file_b_->file_path},
{ManifestStatus::kAdded, ManifestStatus::kAdded},
{snapshot->snapshot_id, snapshot->snapshot_id});
}

TEST_F(FastAppendTest, AppendManifestWithExplicitInvalidSnapshotIdIsCopied) {
Expand All @@ -533,10 +521,10 @@ TEST_F(FastAppendTest, AppendManifestWithExplicitInvalidSnapshotIdIsCopied) {
ASSERT_THAT(manifests, ::testing::SizeIs(1));
EXPECT_NE(manifests[0].manifest_path, path);
EXPECT_EQ(manifests[0].added_snapshot_id, snapshot->snapshot_id);
ICEBERG_UNWRAP_OR_FAIL(auto entries, ReadEntries(manifests[0]));
ASSERT_THAT(entries, ::testing::SizeIs(2));
EXPECT_EQ(entries[0].snapshot_id, snapshot->snapshot_id);
EXPECT_EQ(entries[1].snapshot_id, snapshot->snapshot_id);
ExpectManifestEntriesWithSnapshotIds(manifests[0],
{file_a_->file_path, file_b_->file_path},
{ManifestStatus::kAdded, ManifestStatus::kAdded},
{snapshot->snapshot_id, snapshot->snapshot_id});
}

TEST_F(FastAppendTest, AppendDuplicateFile) {
Expand Down
Loading