PostGIS  2.2.7dev-r@@SVN_REVISION@@
static ND_STATS* pg_nd_stats_from_tuple ( HeapTuple  stats_tuple,
int  mode 
)
static

Definition at line 804 of file gserialized_estimate.c.

References STATISTIC_KIND_2D, and STATISTIC_KIND_ND.

Referenced by gserialized_gist_sel(), and pg_get_nd_stats().

805 {
806  int stats_kind = STATISTIC_KIND_ND;
807  int rv, nvalues;
808  float4 *floatptr;
809  ND_STATS *nd_stats;
810 
811  /* If we're in 2D mode, set the kind appropriately */
812  if ( mode == 2 ) stats_kind = STATISTIC_KIND_2D;
813 
814  /* Then read the geom status histogram from that */
815  rv = get_attstatsslot(stats_tuple, 0, 0, stats_kind, InvalidOid,
816  NULL, NULL, NULL, &floatptr, &nvalues);
817  if ( ! rv ) {
818  POSTGIS_DEBUGF(2,
819  "no slot of kind %d in stats tuple", stats_kind);
820  return NULL;
821  }
822 
823  /* Clone the stats here so we can release the attstatsslot immediately */
824  nd_stats = palloc(sizeof(float) * nvalues);
825  memcpy(nd_stats, floatptr, sizeof(float) * nvalues);
826 
827  /* Clean up */
828  free_attstatsslot(0, NULL, 0, floatptr, nvalues);
829 
830  return nd_stats;
831 }
#define STATISTIC_KIND_2D
N-dimensional statistics structure.
#define STATISTIC_KIND_ND
Assign a number to the n-dimensional statistics kind.

Here is the caller graph for this function: