We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65fe3a0 commit 231b62bCopy full SHA for 231b62b
1 file changed
include/builders/external_memory_builder_partitioned_phf.hpp
@@ -281,7 +281,11 @@ struct external_memory_builder_partitioned_phf {
281
282
struct meta_partition {
283
meta_partition(std::string const& dir_name, uint64_t id)
284
- : m_filename(dir_name + "/pthash.temp." + std::to_string(id)), m_size(0) {}
+ : m_filename(dir_name + "/pthash.temp." + std::to_string(id)), m_size(0) {
285
+ // Truncate the file if it exists from a previous run
286
+ std::ofstream truncate(m_filename.c_str(), std::ofstream::binary | std::ofstream::trunc);
287
+ truncate.close();
288
+ }
289
290
void push_back(hash_type hash) {
291
m_hashes.push_back(hash);
@@ -322,4 +326,4 @@ struct external_memory_builder_partitioned_phf {
322
326
};
323
327
324
328
325
-} // namespace pthash
329
+} // namespace pthash
0 commit comments