PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ pg_nd_stats_from_tuple()

static ND_STATS* pg_nd_stats_from_tuple ( HeapTuple  stats_tuple,
int  mode 
)
static

Definition at line 919 of file gserialized_estimate.c.

920 {
921  int stats_kind = STATISTIC_KIND_ND;
922  int rv;
923  ND_STATS *nd_stats;
924 
925  /* If we're in 2D mode, set the kind appropriately */
926  if ( mode == 2 ) stats_kind = STATISTIC_KIND_2D;
927 
928  /* Then read the geom status histogram from that */
929  {
930  AttStatsSlot sslot;
931  rv = get_attstatsslot(&sslot, stats_tuple, stats_kind, InvalidOid,
932  ATTSTATSSLOT_NUMBERS);
933  if ( ! rv ) {
934  POSTGIS_DEBUGF(2, "no slot of kind %d in stats tuple", stats_kind);
935  return NULL;
936  }
937 
938  /* Clone the stats here so we can release the attstatsslot immediately */
939  nd_stats = palloc(sizeof(float4) * sslot.nnumbers);
940  memcpy(nd_stats, sslot.numbers, sizeof(float4) * sslot.nnumbers);
941 
942  free_attstatsslot(&sslot);
943  }
944  return nd_stats;
945 }
#define STATISTIC_KIND_2D
#define STATISTIC_KIND_ND
N-dimensional statistics structure.

References STATISTIC_KIND_2D, and STATISTIC_KIND_ND.

Referenced by gserialized_sel_internal(), and pg_get_nd_stats().

Here is the caller graph for this function: