Skip to content

Commit ba358af

Browse files
committed
Fix.
1 parent 1e0405e commit ba358af

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/data/sparse_page_source.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,12 @@ class SparsePageSourceImpl : public BatchIteratorImpl<S> {
162162
std::unique_ptr<SparsePageFormat<S>> fmt{CreatePageFormat<S>("raw")};
163163

164164
auto name = cache_info_->ShardName();
165-
std::unique_ptr<dmlc::Stream> fo{dmlc::Stream::Create(name.c_str(), "a")};
165+
std::unique_ptr<dmlc::Stream> fo;
166+
if (this->Iter() == 0) {
167+
fo.reset(dmlc::Stream::Create(name.c_str(), "w"));
168+
} else {
169+
fo.reset(dmlc::Stream::Create(name.c_str(), "a"));
170+
}
166171

167172
auto bytes = fmt->Write(*page_, fo.get());
168173

0 commit comments

Comments
 (0)