Skip to content

Commit 042a96c

Browse files
committed
fix: review comments
1 parent 24182ac commit 042a96c

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/iceberg/manifest/rolling_manifest_writer.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ RollingManifestWriter::RollingManifestWriter(
3232

3333
RollingManifestWriter::~RollingManifestWriter() {
3434
// Ensure we close the current writer if not already closed
35-
if (!closed_) {
36-
(void)CloseCurrentWriter();
37-
}
35+
std::ignore = Close();
3836
}
3937

4038
Status RollingManifestWriter::WriteAddedEntry(
@@ -96,13 +94,13 @@ bool RollingManifestWriter::ShouldRollToNewFile() const {
9694
if (current_writer_ == nullptr) {
9795
return false;
9896
}
99-
// Roll when row count is a multiple of ROWS_DIVISOR and file size >= target
97+
// Roll when row count is a multiple of the divisor and file size >= target
10098
if (current_file_rows_ % kRowsDivisor == 0) {
10199
auto length_result = current_writer_->length();
102100
if (length_result.has_value()) {
103101
return length_result.value() >= target_file_size_in_bytes_;
104102
}
105-
// If we can't get the length, don't roll
103+
// TODO(anyone): If we can't get the length, don't roll for now, revisit this later.
106104
}
107105
return false;
108106
}

src/iceberg/manifest/rolling_manifest_writer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
namespace iceberg {
3636

3737
/// \brief A rolling manifest writer that can produce multiple manifest files.
38-
///
39-
/// As opposed to ManifestWriter, a rolling writer could produce multiple manifest
40-
/// files.
4138
class ICEBERG_EXPORT RollingManifestWriter {
4239
public:
4340
/// \brief Factory function type for creating ManifestWriter instances.
@@ -115,6 +112,8 @@ class ICEBERG_EXPORT RollingManifestWriter {
115112
/// \brief Close the current writer and add its ManifestFile to the list.
116113
Status CloseCurrentWriter();
117114

115+
/// \brief The number of rows after which to consider rolling to a new file.
116+
/// \note This aligned with Iceberg's Java impl.
118117
static constexpr int64_t kRowsDivisor = 250;
119118

120119
ManifestWriterFactory manifest_writer_factory_;

0 commit comments

Comments
 (0)