What stats cells overlap with this ND_BOX? Put the lowest cell addresses in ND_IBOX->min and the highest in ND_IBOX->max.
Definition at line 585 of file gserialized_estimate.c.
586{
587 int d;
588
590
591
592 memset(nd_ibox, 0,
sizeof(
ND_IBOX));
593
594
595 for ( d = 0; d < nd_stats->
ndims; d++ )
596 {
599 double width = smax - smin;
600
602 {
604 }
605 else
606 {
607 int size = (int)roundf(nd_stats->
size[d]);
608
609
610 nd_ibox->
min[d] = floor(size * (nd_box->
min[d] - smin) / width);
611 nd_ibox->
max[d] = floor(size * (nd_box->
max[d] - smin) / width);
612
613 POSTGIS_DEBUGF(5, " stats: dim %d: min %g: max %g: width %g", d, smin, smax, width);
614 POSTGIS_DEBUGF(5,
" overlap: dim %d: (%d, %d)", d, nd_ibox->
min[d], nd_ibox->
max[d]);
615
616
617 nd_ibox->
min[d] = Max(nd_ibox->
min[d], 0);
618 nd_ibox->
max[d] = Min(nd_ibox->
max[d], size - 1);
619 }
620 }
621 return true;
622}
static char * nd_box_to_json(const ND_BOX *nd_box, int ndims)
Convert an ND_BOX to a JSON string for printing.
#define MIN_DIMENSION_WIDTH
Minimum width of a dimension that we'll bother trying to compute statistics on.
References ND_STATS_T::extent, ND_BOX_T::max, ND_IBOX_T::max, ND_BOX_T::min, ND_IBOX_T::min, MIN_DIMENSION_WIDTH, nd_box_to_json(), ND_STATS_T::ndims, and ND_STATS_T::size.
Referenced by compute_gserialized_stats_mode(), estimate_join_selectivity(), and estimate_selectivity().