Unverified Commit 66182b28 authored by Jinjing Zhou's avatar Jinjing Zhou Committed by GitHub
Browse files

[Serialization] Better error message when idx_list out of bound (#2848)


Co-authored-by: default avatarMinjie Wang <wmjlyjemaine@gmail.com>
parent c37e0364
...@@ -163,7 +163,11 @@ StorageMetaData LoadDGLGraphs(const std::string &filename, ...@@ -163,7 +163,11 @@ StorageMetaData LoadDGLGraphs(const std::string &filename,
// Would be better if idx_list is sorted. However the returned the graphs // Would be better if idx_list is sorted. However the returned the graphs
// should be the same order as the idx_list // should be the same order as the idx_list
for (uint64_t i = 0; i < idx_list.size(); ++i) { for (uint64_t i = 0; i < idx_list.size(); ++i) {
fs->Seek(graph_indices[idx_list[i]]); auto gid = idx_list[i];
CHECK((gid < graph_indices.size()) && (gid >= 0))
<< "ID " << gid
<< " in idx_list is out of bound. Please check your idx_list.";
fs->Seek(graph_indices[gid]);
GraphData gdata = GraphData::Create(); GraphData gdata = GraphData::Create();
GraphDataObject *gdata_ptr = GraphDataObject *gdata_ptr =
const_cast<GraphDataObject *>(gdata.as<GraphDataObject>()); const_cast<GraphDataObject *>(gdata.as<GraphDataObject>());
......
...@@ -169,7 +169,11 @@ std::vector<HeteroGraphData> LoadHeteroGraphs(const std::string &filename, ...@@ -169,7 +169,11 @@ std::vector<HeteroGraphData> LoadHeteroGraphs(const std::string &filename,
// Would be better if idx_list is sorted. However the returned the graphs // Would be better if idx_list is sorted. However the returned the graphs
// should be the same order as the idx_list // should be the same order as the idx_list
for (uint64_t i = 0; i < idx_list.size(); ++i) { for (uint64_t i = 0; i < idx_list.size(); ++i) {
fs->Seek(graph_indices[idx_list[i]]); auto gid = idx_list[i];
CHECK((gid < graph_indices.size()) && (gid >= 0))
<< "ID " << gid
<< " in idx_list is out of bound. Please check your idx_list.";
fs->Seek(graph_indices[gid]);
HeteroGraphData gdata = HeteroGraphData::Create(); HeteroGraphData gdata = HeteroGraphData::Create();
auto hetero_data = gdata.sptr(); auto hetero_data = gdata.sptr();
fs->Read(&hetero_data); fs->Read(&hetero_data);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment