SET_RETONE in statcollect()
For each row of a table, the statcollect() function collects the statistics data for the column that has the user-defined data type. When the iterator-status constant is SET_RETONE, the database server has invoked the statcollect() function on a single row of the table on which statistics is being gathered. At this point, statcollect() reads the column value from the first argument and places it into the statistics-collection structure.
- Obtain the address of the statistics-collection structure from the user state of the MI_FPARAM structure with the mi_fp_funcstate() function.
- Compare the current column value with the current maximum and minimum values (if maximum and minimum are desired).
- Merge the current column value into the distribution data in the statistics-collection structure.
- Handle a NULL column value as appropriate for your distribution.
The SET_RETONE case in the OpaqueStatCollect() function (where Opaque is the name of your opaque data type) that BladeSmith generates automatically calls the Opaque_SetMinValue() and Opaque_SetMinValue() functions to compare the current column value with the existing minimum and maximum. It then calls the Opaque_Histogram() function to merge the column value into the distribution array of the Opaque_stat_t statistics-collection structure. However, you must provide this code within the Opaque_SetMinValue() and Opaque_Histogram() functions to perform the actual comparisons and distribution for your Opaque data type.