Skip to content

Commit 967496b

Browse files
committed
address feedback
1 parent 9093d1b commit 967496b

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

src/iceberg/data/delete_loader.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,19 @@ Result<PositionDeleteIndex> DeleteLoader::LoadPositionDeletes(
110110
PositionDeleteIndex index;
111111

112112
for (const auto& file : delete_files) {
113+
if (file->referenced_data_file.has_value() &&
114+
file->referenced_data_file.value() != data_file_path) {
115+
continue;
116+
}
117+
113118
if (file->IsDeletionVector()) {
114119
ICEBERG_RETURN_UNEXPECTED(LoadDV(*file, index));
120+
continue;
115121
}
116122

117123
ICEBERG_PRECHECK(file->content == DataFile::Content::kPositionDeletes,
118124
"Expected position delete file but got content type {}",
119-
static_cast<int>(file->content));
125+
ToString(file->content));
120126

121127
ICEBERG_RETURN_UNEXPECTED(LoadPositionDelete(*file, index, data_file_path));
122128
}

src/iceberg/data/delete_loader.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include "iceberg/iceberg_export.h"
3030
#include "iceberg/result.h"
3131
#include "iceberg/type_fwd.h"
32-
#include "iceberg/util/struct_like_set.h"
3332

3433
namespace iceberg {
3534

src/iceberg/test/delete_loader_test.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,20 @@ TEST_F(DeleteLoaderTest, LoadPositionDeletesFiltersByDataFilePath) {
193193
ASSERT_TRUE(result_none.value().IsEmpty());
194194
}
195195

196+
TEST_F(DeleteLoaderTest, LoadPositionDeletesSkipsMismatchedReferencedDataFile) {
197+
auto delete_file = std::make_shared<DataFile>(DataFile{
198+
.content = DataFile::Content::kPositionDeletes,
199+
.file_path = "missing-pos-delete.parquet",
200+
.file_format = FileFormatType::kParquet,
201+
.referenced_data_file = "other-data.parquet",
202+
});
203+
204+
std::vector<std::shared_ptr<DataFile>> files = {delete_file};
205+
auto result = loader_->LoadPositionDeletes(files, "data.parquet");
206+
ASSERT_THAT(result, IsOk());
207+
ASSERT_TRUE(result.value().IsEmpty());
208+
}
209+
196210
TEST_F(DeleteLoaderTest, LoadPositionDeletesRejectsDV) {
197211
auto dv_file = std::make_shared<DataFile>(DataFile{
198212
.content = DataFile::Content::kPositionDeletes,

src/iceberg/type_fwd.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ class ArrayLike;
188188
class MapLike;
189189
class StructLike;
190190
class StructLikeAccessor;
191+
template <bool kValidate>
192+
class StructLikeSet;
193+
using UncheckedStructLikeSet = StructLikeSet<false>;
191194

192195
/// \brief Catalog
193196
class Catalog;

src/iceberg/util/struct_like_set.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ class ICEBERG_TEMPLATE_CLASS_EXPORT StructLikeSet {
101101
std::unordered_set<std::unique_ptr<StructLike>, KeyHash, KeyEqual> set_;
102102
};
103103

104-
/// \brief Type alias for StructLikeSet without schema validation, for callers
105-
/// that guarantee schema conformance.
106-
using UncheckedStructLikeSet = StructLikeSet<false>;
107-
108104
extern template class ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT StructLikeSet<true>;
109105
extern template class ICEBERG_EXTERN_TEMPLATE_CLASS_EXPORT StructLikeSet<false>;
110106

0 commit comments

Comments
 (0)