PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ gserialized_gist_picksplit_fallback()

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

Definition at line 1337 of file gserialized_gist_nd.c.

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

Referenced by gserialized_gist_picksplit().

1338 {
1339  OffsetNumber i, maxoff;
1340  GIDX *unionL = NULL;
1341  GIDX *unionR = NULL;
1342  int nbytes;
1343 
1344  POSTGIS_DEBUG(4, "[GIST] in fallback picksplit function");
1345 
1346  maxoff = entryvec->n - 1;
1347 
1348  nbytes = (maxoff + 2) * sizeof(OffsetNumber);
1349  v->spl_left = (OffsetNumber*) palloc(nbytes);
1350  v->spl_right = (OffsetNumber*) palloc(nbytes);
1351  v->spl_nleft = v->spl_nright = 0;
1352 
1353  for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
1354  {
1355  GIDX *cur = (GIDX*)DatumGetPointer(entryvec->vector[i].key);
1356 
1357  if (i <= (maxoff - FirstOffsetNumber + 1) / 2)
1358  {
1359  v->spl_left[v->spl_nleft] = i;
1360  if (unionL == NULL)
1361  {
1362  unionL = gidx_copy(cur);
1363  }
1364  else
1365  {
1366  gidx_merge(&unionL, cur);
1367  }
1368  v->spl_nleft++;
1369  }
1370  else
1371  {
1372  v->spl_right[v->spl_nright] = i;
1373  if (unionR == NULL)
1374  {
1375  unionR = gidx_copy(cur);
1376  }
1377  else
1378  {
1379  gidx_merge(&unionR, cur);
1380  }
1381  v->spl_nright++;
1382  }
1383  }
1384 
1385  if (v->spl_ldatum_exists)
1386  gidx_merge(&unionL, (GIDX*)DatumGetPointer(v->spl_ldatum));
1387 
1388  v->spl_ldatum = PointerGetDatum(unionL);
1389 
1390  if (v->spl_rdatum_exists)
1391  gidx_merge(&unionR, (GIDX*)DatumGetPointer(v->spl_rdatum));
1392 
1393  v->spl_rdatum = PointerGetDatum(unionR);
1394  v->spl_ldatum_exists = v->spl_rdatum_exists = false;
1395 }
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: