PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ gserialized_gist_picksplit_fallback()

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

Definition at line 1421 of file gserialized_gist_nd.c.

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