PostGIS  2.5.0dev-r@@SVN_REVISION@@
static void gserialized_gist_picksplit_fallback ( GistEntryVector *  entryvec,
GIST_SPLITVEC *  v 
)
static

Definition at line 1636 of file gserialized_gist_nd.c.

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

Referenced by gserialized_gist_picksplit().

1637 {
1638  OffsetNumber i, maxoff;
1639  GIDX *unionL = NULL;
1640  GIDX *unionR = NULL;
1641  int nbytes;
1642 
1643  POSTGIS_DEBUG(4, "[GIST] in fallback picksplit function");
1644 
1645  maxoff = entryvec->n - 1;
1646 
1647  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1648  v->spl_left = (OffsetNumber*) palloc(nbytes);
1649  v->spl_right = (OffsetNumber*) palloc(nbytes);
1650  v->spl_nleft = v->spl_nright = 0;
1651 
1652  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1653  {
1654  GIDX *cur = (GIDX*)DatumGetPointer(entryvec->vector[i].key);
1655 
1656  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1657  {
1658  v->spl_left[v->spl_nleft] = i;
1659  if (unionL == NULL)
1660  {
1661  unionL = gidx_copy(cur);
1662  }
1663  else
1664  {
1665  gidx_merge(&unionL, cur);
1666  }
1667  v->spl_nleft++;
1668  }
1669  else
1670  {
1671  v->spl_right[v->spl_nright] = i;
1672  if (unionR == NULL)
1673  {
1674  unionR = gidx_copy(cur);
1675  }
1676  else
1677  {
1678  gidx_merge(&unionR, cur);
1679  }
1680  v->spl_nright++;
1681  }
1682  }
1683 
1684  if (v->spl_ldatum_exists)
1685  gidx_merge(&unionL, (GIDX*)DatumGetPointer(v->spl_ldatum));
1686 
1687  v->spl_ldatum = PointerGetDatum(unionL);
1688 
1689  if (v->spl_rdatum_exists)
1690  gidx_merge(&unionR, (GIDX*)DatumGetPointer(v->spl_rdatum));
1691 
1692  v->spl_rdatum = PointerGetDatum(unionR);
1693  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1694 }
void gidx_merge(GIDX **b_union, GIDX *b_new)
GIDX * gidx_copy(GIDX *b)

Here is the call graph for this function:

Here is the caller graph for this function: