EXTFNAPIV4_DESCRIBE_PARM_DISTINCT_VALUES Attribute (Get)

The EXTFNAPIV4_DESCRIBE_PARM_DISTINCT_VALUES attribute returns the number of distinct values. Used in a describe_parameter_get scenario.

Data Type

a_v4_extfn_estimate

Description

Returns the estimated number of distinct values across all invocations. valid only for scalar parameters.

Usage

If this information is available, the UDF returns the estimated number of distinct values with 100% confidence. If the information is not available, the UDF returns an estimate of 0 with 0% confidence.

Returns

On success, returns the sizeof(a_v4_extfn_estimate).

On failure, returns one of the generic describe_parameter errors or:
  • EXTFNAPIV4_DESCRIBE_BUFFER_SIZE_MISMATCH – get error returned if the describe_buffer is not the size of a_v4_extfn_estimate.
  • EXTFNAPIV4_DESCRIBE_INVALID_STATE – get error returned if the state is not greater than Initial.
  • EXTFNAPIV4_DESCRIBE_INVALID_PARAMETER – get error returned if the parameter is a table parameter.

Query Processing States

Valid in:
  • Annotation state
  • Query Optimization state
  • Plan Building state
  • Execution state

Example

Sample _describe_extfn API function code fragment:

if( ctx->current_state >= EXTFNAPIV4_STATE_ANNOTATION ) {
	desc_est.value = 0.0;
	desc_est.confidence = 0.0;

	desc_rc = ctx->describe_parameter_get( ctx,
		1,
		EXTFNAPIV4_DESCRIBE_PARM_DISTINCT_VALUES,
		&desc_est, sizeof(a_v4_extfn_estimate) );
}
Related concepts
Query Processing States
Related reference
EXTFNAPIV4_DESCRIBE_PARM_DISTINCT_VALUES Attribute (Set)
EXTFNAPIV4_DESCRIBE_PARM_TYPE Attribute (Get)
Generic describe_parameter Errors