47 pd_order->
pick_x = matrix_version ?
49 pd_order->
pick_y = matrix_version ?
81 size_t *total_pd_orders,
83 clock_t start_t = clock();
85 const int tuple_limit = 1000000;
87 PGR_DBG(
"pgr_get_pd_orders_data");
93 for (i = 0; i < 14; ++i) {
101 info[1].
name =
"demand";
102 info[2].
name =
"p_x";
103 info[3].
name =
"p_y";
104 info[4].
name =
"p_open";
105 info[5].
name =
"p_close";
106 info[6].
name =
"p_service";
107 info[7].
name =
"d_x";
108 info[8].
name =
"d_y";
109 info[9].
name =
"d_open";
110 info[10].
name =
"d_close";
111 info[11].
name =
"d_service";
112 info[12].
name =
"p_node_id";
113 info[13].
name =
"d_node_id";
146 bool moredata =
true;
147 (*total_pd_orders) = total_tuples = 0;
151 while (moredata ==
true) {
152 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
153 if (total_tuples == 0) {
156 size_t ntuples = SPI_processed;
157 total_tuples += ntuples;
158 PGR_DBG(
"SPI_processed %ld", ntuples);
160 if ((*pd_orders) == NULL)
168 if ((*pd_orders) == NULL) {
169 elog(ERROR,
"Out of memory");
173 SPITupleTable *tuptable = SPI_tuptable;
174 TupleDesc tupdesc = SPI_tuptable->tupdesc;
175 PGR_DBG(
"processing %ld", ntuples);
176 for (t = 0; t < ntuples; t++) {
177 HeapTuple tuple = tuptable->vals[t];
179 &(*pd_orders)[total_tuples - ntuples + t]);
181 SPI_freetuptable(tuptable);
187 SPI_cursor_close(SPIportal);
189 if (total_tuples == 0) {
190 (*total_pd_orders) = 0;
195 (*total_pd_orders) = total_tuples;
197 PGR_DBG(
"Finish reading %ld orders for matrix", (*total_pd_orders));
199 PGR_DBG(
"Finish reading %ld orders for euclidean", (*total_pd_orders));
201 time_msg(
"reading edges", start_t, clock());
208 size_t *total_pd_orders) {
216 size_t *total_pd_orders) {