MCPcopy Create free account
hub / github.com/alibaba/GraphScope / LoadFragment

Method LoadFragment

analytical_engine/core/java/graphx_loader.h:116–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114 ~GraphXLoader() {}
115
116 boost::leaf::result<vineyard::ObjectID> LoadFragment() {
117 // make table from raw data
118 auto oids = raw_data->GetOids();
119 auto src_oids = raw_data->GetSrcOids();
120 auto dst_oids = raw_data->GetDstOids();
121 auto vdatas = raw_data->GetVdataArray();
122 auto edatas = raw_data->GetEdataArray();
123
124 std::vector<std::shared_ptr<arrow::Field>> vertex_schema_vector = {
125 arrow::field("ID", vineyard::ConvertToArrowType<OID_T>::TypeValue()),
126 arrow::field("VALUE",
127 vineyard::ConvertToArrowType<VDATA_T>::TypeValue())};
128
129 auto vertex_schema = std::make_shared<arrow::Schema>(vertex_schema_vector);
130
131 std::shared_ptr<arrow::Table> vertex_table =
132 arrow::Table::Make(vertex_schema, {oids, vdatas});
133
134 LOG(INFO) << "Finish built vertex table";
135
136 std::vector<std::shared_ptr<arrow::Field>> edge_schema_vector = {
137 arrow::field("SRC", vineyard::ConvertToArrowType<OID_T>::TypeValue()),
138 arrow::field("DST", vineyard::ConvertToArrowType<OID_T>::TypeValue()),
139 arrow::field("VALUE",
140 vineyard::ConvertToArrowType<EDATA_T>::TypeValue())};
141
142 auto edge_schema = std::make_shared<arrow::Schema>(edge_schema_vector);
143
144 std::shared_ptr<arrow::Table> edge_table =
145 arrow::Table::Make(edge_schema, {src_oids, dst_oids, edatas});
146
147 LOG(INFO) << "Finish built edge table";
148 // load fragment from tables.
149 BOOST_LEAF_CHECK(this->AddVertexTable("v0", vertex_table));
150 LOG(INFO) << "Finish adding vertices";
151
152 BOOST_LEAF_CHECK(this->ConstructVertices());
153 LOG(INFO) << "Finish Construct vertices";
154
155 BOOST_LEAF_CHECK(this->AddEdgeTable("v0", "v0", "e0", edge_table));
156 LOG(INFO) << "Finish adding edges";
157
158 BOOST_LEAF_CHECK(this->ConstructEdges());
159 LOG(INFO) << "Finish Construct edges";
160
161 return this->ConstructFragment();
162 }
163
164 private:
165 std::shared_ptr<raw_data_t> raw_data;

Callers 15

LoadFragmentFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
LoadGiraphFragmentFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by 15

mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
LoadGiraphFragmentFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36
mainFunction · 0.36