PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ gserialized_gist_picksplit_fallback()

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

Definition at line 1640 of file gserialized_gist_nd.c.

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

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

Referenced by gserialized_gist_picksplit().

Here is the call graph for this function:
Here is the caller graph for this function: