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";
147 bool moredata =
true;
148 (*total_pd_orders) = total_tuples = 0;
152 while (moredata ==
true) {
153 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
154 if (total_tuples == 0) {
157 ntuples = SPI_processed;
158 total_tuples += ntuples;
159 PGR_DBG(
"SPI_processed %ld", ntuples);
161 if ((*pd_orders) == NULL)
169 if ((*pd_orders) == NULL) {
170 elog(ERROR,
"Out of memory");
174 SPITupleTable *tuptable = SPI_tuptable;
175 TupleDesc tupdesc = SPI_tuptable->tupdesc;
176 PGR_DBG(
"processing %ld", ntuples);
177 for (t = 0; t < ntuples; t++) {
178 HeapTuple tuple = tuptable->vals[t];
180 &(*pd_orders)[total_tuples - ntuples + t]);
182 SPI_freetuptable(tuptable);
188 SPI_cursor_close(SPIportal);
190 if (total_tuples == 0) {
191 (*total_pd_orders) = 0;
196 (*total_pd_orders) = total_tuples;
198 PGR_DBG(
"Finish reading %ld orders for matrix", (*total_pd_orders));
200 PGR_DBG(
"Finish reading %ld orders for eucledian", (*total_pd_orders));
202 time_msg(
"reading edges", start_t, clock());
209 size_t *total_pd_orders) {
217 size_t *total_pd_orders) {
int64_t pgr_SPI_getBigInt(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
Function returns the value of specified column in integer type.
void time_msg(char *msg, clock_t start_t, clock_t end_t)
void pgr_fetch_column_info(Column_info_t info[], int info_size)
Function tells expected type of each column and then check the correspondence type of each column...
bool column_found(int colNumber)
Function will check whether the colNumber represent any specific column or NULL (SPI_ERROR_NOATTRIBUT...
Portal pgr_SPI_cursor_open(SPIPlanPtr SPIplan)
double pgr_SPI_getFloat8(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
Function returns the value of specified column in double type.
SPIPlanPtr pgr_SPI_prepare(char *sql)