Skip to content

Commit

Permalink
Added assertions and cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Giorgi Lomia committed Oct 11, 2021
1 parent 148c34d commit 9ceb2fe
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tools/graph-stats/graph-memory-stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <arrow/type_traits.h>

#include "katana/ArrowVisitor.h"
#include "katana/ErrorCode.h"
#include "katana/Galois.h"
#include "katana/JSON.h"
#include "katana/Logging.h"
Expand Down Expand Up @@ -138,9 +139,15 @@ SaveToJson(
}

myfile.open(path_to_save);

if (!myfile) {
return KATANA_ERROR(
katana::ErrorCode::ArrowError, "Could not open file at {}",
path_to_save);
}

myfile << serialized;
myfile.close();

return katana::ResultSuccess();
}

Expand All @@ -158,8 +165,12 @@ GatherMemoryAllocation(
std::string prop_name = schema->field(i)->name();
auto dtype = schema->field(i)->type();
if (node_or_edge) {
KATANA_LOG_ASSERT(
g->GetNodeProperty(prop_name).value()->num_chunks() == 1);
prop_field = g->GetNodeProperty(prop_name).value()->chunk(0);
} else {
KATANA_LOG_ASSERT(
g->GetEdgeProperty(prop_name).value()->num_chunks() == 1);
prop_field = g->GetEdgeProperty(prop_name).value()->chunk(0);
}
auto bit_width = arrow::bit_width(dtype->id());
Expand Down

0 comments on commit 9ceb2fe

Please sign in to comment.