PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ fallbackSplit()

static void fallbackSplit ( GistEntryVector *  entryvec,
GIST_SPLITVEC *  v 
)
static

Definition at line 1279 of file gserialized_gist_2d.c.

1280 {
1281  OffsetNumber i,
1282  maxoff;
1283  BOX2DF *unionL = NULL,
1284  *unionR = NULL;
1285  int nbytes;
1286 
1287  maxoff = entryvec->n - 1;
1288 
1289  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1290  v->spl_left = (OffsetNumber *) palloc(nbytes);
1291  v->spl_right = (OffsetNumber *) palloc(nbytes);
1292  v->spl_nleft = v->spl_nright = 0;
1293 
1294  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1295  {
1296  BOX2DF *cur = (BOX2DF *) DatumGetPointer(entryvec->vector[i].key);
1297 
1298  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1299  {
1300  v->spl_left[v->spl_nleft] = i;
1301  if (unionL == NULL)
1302  {
1303  unionL = (BOX2DF *) palloc(sizeof(BOX2DF));
1304  *unionL = *cur;
1305  }
1306  else
1307  adjustBox(unionL, cur);
1308 
1309  v->spl_nleft++;
1310  }
1311  else
1312  {
1313  v->spl_right[v->spl_nright] = i;
1314  if (unionR == NULL)
1315  {
1316  unionR = (BOX2DF *) palloc(sizeof(BOX2DF));
1317  *unionR = *cur;
1318  }
1319  else
1320  adjustBox(unionR, cur);
1321 
1322  v->spl_nright++;
1323  }
1324  }
1325 
1326  if (v->spl_ldatum_exists)
1327  adjustBox(unionL, (BOX2DF *) DatumGetPointer(v->spl_ldatum));
1328  v->spl_ldatum = BoxPGetDatum(unionL);
1329 
1330  if (v->spl_rdatum_exists)
1331  adjustBox(unionR, (BOX2DF *) DatumGetPointer(v->spl_rdatum));
1332  v->spl_rdatum = BoxPGetDatum(unionR);
1333 
1334  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1335 }
static void adjustBox(BOX2DF *b, BOX2DF *addon)

References adjustBox(), and rtgdalraster::cur.

Referenced by gserialized_gist_picksplit_2d().

Here is the call graph for this function:
Here is the caller graph for this function: