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

Function output_nd_array

analytical_engine/test/run_java_app.cc:62–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60 vineyard::property_graph_types::VID_TYPE>;
61
62void output_nd_array(const grape::CommSpec& comm_spec,
63 std::unique_ptr<grape::InArchive> arc,
64 const std::string& output_path, int data_type_expected) {
65 if (comm_spec.worker_id() == 0) {
66 grape::OutArchive oarc;
67 oarc = std::move(*arc);
68
69 int64_t ndim, length1, length2;
70 int data_type;
71 oarc >> ndim;
72 VLOG(1) << "ndim: " << ndim;
73 CHECK_EQ(ndim, 1);
74 oarc >> length1;
75 oarc >> data_type;
76 VLOG(1) << "length1: " << length1 << ",data type: " << data_type;
77 CHECK_EQ(data_type, data_type_expected);
78 oarc >> length2;
79 VLOG(1) << "length2: " << length2;
80 CHECK_EQ(length1, length2);
81
82 std::ofstream assembled_ostream;
83 assembled_ostream.open(output_path);
84 VLOG(1) << "osream " << output_path;
85 if (data_type_expected == 7) {
86 for (int64_t i = 0; i < length1; ++i) {
87 double v;
88 oarc >> v;
89 assembled_ostream << v << std::endl;
90 }
91 } else if (data_type_expected == 4) {
92 for (int64_t i = 0; i < length1; ++i) {
93 int64_t v;
94 oarc >> v;
95 assembled_ostream << v << std::endl;
96 }
97 } else if (data_type_expected == vineyard::TypeToInt<double>::value) {
98 for (int64_t i = 0; i < length1; ++i) {
99 double v;
100 oarc >> v;
101 assembled_ostream << v << std::endl;
102 }
103 } else {
104 LOG(FATAL) << "Unregonizable data type " << data_type_expected;
105 }
106
107 VLOG(1) << "output complete: " << oarc.Empty() << output_path;
108 CHECK(oarc.Empty());
109
110 assembled_ostream.close();
111 }
112}
113
114void output_data_frame(const grape::CommSpec& comm_spec,
115 std::unique_ptr<grape::InArchive> arc,

Callers 3

RunPropertySSSPFunction · 0.70
QueryPropertyFunction · 0.70
QueryProjectedFunction · 0.70

Calls 4

worker_idMethod · 0.80
EmptyMethod · 0.65
closeMethod · 0.65
openMethod · 0.45

Tested by

no test coverage detected