The mi_funcarg_get_distrib() function

The mi_funcarg_get_distrib() function returns the data-distribution information for the column associated with the companion-UDR argument of a cost or selectivity function.

Syntax

mi_bitvarying *mi_funcarg_get_distrib(funcarg_ptr)
   MI_FUNCARG *funcarg_ptr;
funcarg_ptr
A pointer to the MI_FUNCARG structure that describes the companion-UDR argument.
Valid in client LIBMI application? Valid in user-defined routine?
No Yes

Usage

The mi_funcarg_get_distrib() function returns data-distribution information from the MI_FUNCARG structure that funcarg_ptr references. The MI_FUNCARG structure describes an argument of a companion UDR to its cost or selectivity function. Use the mi_funcarg_get_distrib() function only for companion-UDR arguments that are column values; that is, only arguments for which the mi_funcarg_get_argtype() function returns the MI_FUNCARG_COLUMN value.

The data-distribution information is either an ASCII histogram that divides the column values into a prescribed number of bins or it is user-defined statistics. It is the value from the encdat column of the sysdistrib system catalog table. The mi_funcarg_get_distrib() function returns the data-distribution information as an mi_bitvarying varying-length structure. The varying-length data is an mi_statret structure, which contains the actual data distribution.

Use the mi_funcarg_get_distrib() function in a cost or selectivity function to obtain the distribution information for the column with which an argument passed into the expensive UDR is associated.

For more information about cost and selectivity, see the HCL OneDB™ DataBlade® API Programmer's Guide.

Return values

An mi_bitvarying pointer
A pointer to a varying-length structure that contains the data-distribution information for the column associated with the companion-UDR argument.
NULL
This value indicates one of the following conditions:
  • No data-distribution information exists for the column.
  • The companion-UDR argument is not of type MI_FUNCARG_COLUMN.
  • The function was not successful.