45 distance->
id = *default_id;
60 size_t *total_coordinates) {
61 clock_t start_t = clock();
63 const int tuple_limit = 1000000;
65 size_t total_tuples = 0;
70 for (i = 0; i < 3; ++i) {
92 (*total_coordinates) = total_tuples;
94 int64_t default_id = 1;
96 while (moredata ==
true) {
97 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
98 if (total_tuples == 0)
101 size_t ntuples = SPI_processed;
102 total_tuples += ntuples;
105 if ((*coordinates) == NULL)
110 repalloc((*coordinates),
113 if ((*coordinates) == NULL) {
114 elog(ERROR,
"Out of memory");
117 SPITupleTable *tuptable = SPI_tuptable;
118 TupleDesc tupdesc = SPI_tuptable->tupdesc;
119 PGR_DBG(
"Processing %ld coordinates tupĺes", ntuples);
122 for (t = 0; t < ntuples; t++) {
123 HeapTuple tuple = tuptable->vals[t];
126 &(*coordinates)[total_tuples - ntuples + t]);
128 SPI_freetuptable(tuptable);
134 SPI_cursor_close(SPIportal);
137 if (total_tuples == 0) {
138 (*total_coordinates) = 0;
143 (*total_coordinates) = total_tuples;
144 time_msg(
" reading coordinates:", start_t, clock());