1479 bool firstToLeft =
true;
1481 POSTGIS_DEBUG(4,
"[GIST] picksplit in constructsplit function");
1483 if (v->spl_ldatum_exists || v->spl_rdatum_exists)
1485 if (v->spl_ldatum_exists && v->spl_rdatum_exists)
1491 double sizeLR, sizeRL;
1493 gidx_merge(&LRl, (GIDX *)DatumGetPointer(v->spl_ldatum));
1494 gidx_merge(&LRr, (GIDX *)DatumGetPointer(v->spl_rdatum));
1495 gidx_merge(&RLl, (GIDX *)DatumGetPointer(v->spl_ldatum));
1496 gidx_merge(&RLr, (GIDX *)DatumGetPointer(v->spl_rdatum));
1501 POSTGIS_DEBUGF(4,
"[GIST] sizeLR / sizeRL == %.12g / %.12g", sizeLR, sizeRL);
1503 if (sizeLR > sizeRL)
1504 firstToLeft =
false;
1509 GISTENTRY oldUnion, addon;
1511 gistentryinit(oldUnion,
1512 (v->spl_ldatum_exists) ? v->spl_ldatum : v->spl_rdatum,
1515 InvalidOffsetNumber,
1518 gistentryinit(addon, PointerGetDatum(*union1), NULL, NULL, InvalidOffsetNumber,
false);
1520 PointerGetDatum(&oldUnion),
1521 PointerGetDatum(&addon),
1522 PointerGetDatum(&p1));
1523 gistentryinit(addon, PointerGetDatum(*union2), NULL, NULL, InvalidOffsetNumber,
false);
1525 PointerGetDatum(&oldUnion),
1526 PointerGetDatum(&addon),
1527 PointerGetDatum(&p2));
1529 POSTGIS_DEBUGF(4,
"[GIST] p1 / p2 == %.12g / %.12g", p1, p2);
1531 if ((v->spl_ldatum_exists && p1 > p2) || (v->spl_rdatum_exists && p1 < p2))
1532 firstToLeft =
false;
1536 POSTGIS_DEBUGF(4,
"[GIST] firstToLeft == %d", firstToLeft);
1540 v->spl_left = list1;
1541 v->spl_right = list2;
1542 v->spl_nleft = nlist1;
1543 v->spl_nright = nlist2;
1544 if (v->spl_ldatum_exists)
1545 gidx_merge(union1, (GIDX *)DatumGetPointer(v->spl_ldatum));
1546 v->spl_ldatum = PointerGetDatum(*union1);
1547 if (v->spl_rdatum_exists)
1548 gidx_merge(union2, (GIDX *)DatumGetPointer(v->spl_rdatum));
1549 v->spl_rdatum = PointerGetDatum(*union2);
1553 v->spl_left = list2;
1554 v->spl_right = list1;
1555 v->spl_nleft = nlist2;
1556 v->spl_nright = nlist1;
1557 if (v->spl_ldatum_exists)
1558 gidx_merge(union2, (GIDX *)DatumGetPointer(v->spl_ldatum));
1559 v->spl_ldatum = PointerGetDatum(*union2);
1560 if (v->spl_rdatum_exists)
1561 gidx_merge(union1, (GIDX *)DatumGetPointer(v->spl_rdatum));
1562 v->spl_rdatum = PointerGetDatum(*union1);
1565 v->spl_ldatum_exists = v->spl_rdatum_exists =
false;
static float gidx_inter_volume(GIDX *a, GIDX *b)
GIDX * gidx_copy(GIDX *b)
Datum gserialized_gist_penalty(PG_FUNCTION_ARGS)
void gidx_merge(GIDX **b_union, GIDX *b_new)