PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ fallbackSplit()

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

Definition at line 1407 of file gserialized_gist_2d.c.

1408 {
1409  OffsetNumber i,
1410  maxoff;
1411  BOX2DF *unionL = NULL,
1412  *unionR = NULL;
1413  int nbytes;
1414 
1415  maxoff = entryvec->n - 1;
1416 
1417  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1418  v->spl_left = (OffsetNumber *) palloc(nbytes);
1419  v->spl_right = (OffsetNumber *) palloc(nbytes);
1420  v->spl_nleft = v->spl_nright = 0;
1421 
1422  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1423  {
1424  BOX2DF *cur = (BOX2DF *) DatumGetPointer(entryvec->vector[i].key);
1425 
1426  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1427  {
1428  v->spl_left[v->spl_nleft] = i;
1429  if (unionL == NULL)
1430  {
1431  unionL = (BOX2DF *) palloc(sizeof(BOX2DF));
1432  *unionL = *cur;
1433  }
1434  else
1435  adjustBox(unionL, cur);
1436 
1437  v->spl_nleft++;
1438  }
1439  else
1440  {
1441  v->spl_right[v->spl_nright] = i;
1442  if (unionR == NULL)
1443  {
1444  unionR = (BOX2DF *) palloc(sizeof(BOX2DF));
1445  *unionR = *cur;
1446  }
1447  else
1448  adjustBox(unionR, cur);
1449 
1450  v->spl_nright++;
1451  }
1452  }
1453 
1454  if (v->spl_ldatum_exists)
1455  adjustBox(unionL, (BOX2DF *) DatumGetPointer(v->spl_ldatum));
1456  v->spl_ldatum = PointerGetDatum(unionL);
1457 
1458  if (v->spl_rdatum_exists)
1459  adjustBox(unionR, (BOX2DF *) DatumGetPointer(v->spl_rdatum));
1460  v->spl_rdatum = PointerGetDatum(unionR);
1461 
1462  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1463 }
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: