PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ gserialized_gist_picksplit_fallback()

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

Definition at line 1418 of file gserialized_gist_nd.c.

1419 {
1420  OffsetNumber i, maxoff;
1421  GIDX *unionL = NULL;
1422  GIDX *unionR = NULL;
1423  int nbytes;
1424 
1425  POSTGIS_DEBUG(4, "[GIST] in fallback picksplit function");
1426 
1427  maxoff = entryvec->n - 1;
1428 
1429  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1430  v->spl_left = (OffsetNumber *)palloc(nbytes);
1431  v->spl_right = (OffsetNumber *)palloc(nbytes);
1432  v->spl_nleft = v->spl_nright = 0;
1433 
1434  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1435  {
1436  GIDX *cur = (GIDX *)DatumGetPointer(entryvec->vector[i].key);
1437 
1438  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1439  {
1440  v->spl_left[v->spl_nleft] = i;
1441  if (!unionL)
1442  unionL = gidx_copy(cur);
1443  else
1444  gidx_merge(&unionL, cur);
1445  v->spl_nleft++;
1446  }
1447  else
1448  {
1449  v->spl_right[v->spl_nright] = i;
1450  if (!unionR)
1451  unionR = gidx_copy(cur);
1452  else
1453  gidx_merge(&unionR, cur);
1454  v->spl_nright++;
1455  }
1456  }
1457 
1458  if (v->spl_ldatum_exists)
1459  gidx_merge(&unionL, (GIDX *)DatumGetPointer(v->spl_ldatum));
1460 
1461  v->spl_ldatum = PointerGetDatum(unionL);
1462 
1463  if (v->spl_rdatum_exists)
1464  gidx_merge(&unionR, (GIDX *)DatumGetPointer(v->spl_rdatum));
1465 
1466  v->spl_rdatum = PointerGetDatum(unionR);
1467  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1468 }
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: