PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ fallbackSplit()

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

Definition at line 1326 of file gserialized_gist_2d.c.

1327 {
1328  OffsetNumber i,
1329  maxoff;
1330  BOX2DF *unionL = NULL,
1331  *unionR = NULL;
1332  int nbytes;
1333 
1334  maxoff = entryvec->n - 1;
1335 
1336  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1337  v->spl_left = (OffsetNumber *) palloc(nbytes);
1338  v->spl_right = (OffsetNumber *) palloc(nbytes);
1339  v->spl_nleft = v->spl_nright = 0;
1340 
1341  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1342  {
1343  BOX2DF *cur = (BOX2DF *) DatumGetPointer(entryvec->vector[i].key);
1344 
1345  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1346  {
1347  v->spl_left[v->spl_nleft] = i;
1348  if (unionL == NULL)
1349  {
1350  unionL = (BOX2DF *) palloc(sizeof(BOX2DF));
1351  *unionL = *cur;
1352  }
1353  else
1354  adjustBox(unionL, cur);
1355 
1356  v->spl_nleft++;
1357  }
1358  else
1359  {
1360  v->spl_right[v->spl_nright] = i;
1361  if (unionR == NULL)
1362  {
1363  unionR = (BOX2DF *) palloc(sizeof(BOX2DF));
1364  *unionR = *cur;
1365  }
1366  else
1367  adjustBox(unionR, cur);
1368 
1369  v->spl_nright++;
1370  }
1371  }
1372 
1373  if (v->spl_ldatum_exists)
1374  adjustBox(unionL, (BOX2DF *) DatumGetPointer(v->spl_ldatum));
1375  v->spl_ldatum = BoxPGetDatum(unionL);
1376 
1377  if (v->spl_rdatum_exists)
1378  adjustBox(unionR, (BOX2DF *) DatumGetPointer(v->spl_rdatum));
1379  v->spl_rdatum = BoxPGetDatum(unionR);
1380 
1381  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1382 }
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: