PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ gserialized_gist_picksplit_fallback()

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

Definition at line 1526 of file gserialized_gist_nd.c.

References rtgdalraster::cur, gidx_copy(), and gidx_merge().

Referenced by gserialized_gist_picksplit().

1527 {
1528  OffsetNumber i, maxoff;
1529  GIDX *unionL = NULL;
1530  GIDX *unionR = NULL;
1531  int nbytes;
1532 
1533  POSTGIS_DEBUG(4, "[GIST] in fallback picksplit function");
1534 
1535  maxoff = entryvec->n - 1;
1536 
1537  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1538  v->spl_left = (OffsetNumber*) palloc(nbytes);
1539  v->spl_right = (OffsetNumber*) palloc(nbytes);
1540  v->spl_nleft = v->spl_nright = 0;
1541 
1542  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1543  {
1544  GIDX *cur = (GIDX*)DatumGetPointer(entryvec->vector[i].key);
1545 
1546  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1547  {
1548  v->spl_left[v->spl_nleft] = i;
1549  if (unionL == NULL)
1550  {
1551  unionL = gidx_copy(cur);
1552  }
1553  else
1554  {
1555  gidx_merge(&unionL, cur);
1556  }
1557  v->spl_nleft++;
1558  }
1559  else
1560  {
1561  v->spl_right[v->spl_nright] = i;
1562  if (unionR == NULL)
1563  {
1564  unionR = gidx_copy(cur);
1565  }
1566  else
1567  {
1568  gidx_merge(&unionR, cur);
1569  }
1570  v->spl_nright++;
1571  }
1572  }
1573 
1574  if (v->spl_ldatum_exists)
1575  gidx_merge(&unionL, (GIDX*)DatumGetPointer(v->spl_ldatum));
1576 
1577  v->spl_ldatum = PointerGetDatum(unionL);
1578 
1579  if (v->spl_rdatum_exists)
1580  gidx_merge(&unionR, (GIDX*)DatumGetPointer(v->spl_rdatum));
1581 
1582  v->spl_rdatum = PointerGetDatum(unionR);
1583  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1584 }
static void gidx_merge(GIDX **b_union, GIDX *b_new)
static GIDX * gidx_copy(GIDX *b)
Here is the call graph for this function:
Here is the caller graph for this function: