PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ gserialized_gist_picksplit_fallback()

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

Definition at line 1639 of file gserialized_gist_nd.c.

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

Referenced by gserialized_gist_picksplit().

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