EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY (Set)

The EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY attribute indicates that the UDF requires partitioning. Used in a describe_parameter_set scenario.

Data Type

a_v4_extfn_column_list

Description

UDF developers use EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY to programmatically declare that the UDF requires partitioning before invocation can proceed.

Usage

The UDF can inquire to the partition to enforce it, or to dynamically adapt the partitioning. The UDF must allocate the a_v4_extfn_column_list, taking into consideration the total number of columns in the input table, and sending that data to the server.

Returns

On success, returns the size of a_v4_extfn_column_list. This value is equal to:
sizeof(a_v4_extfn_column_list) + sizeof(a_sql_uint32) * number_of_partition_columns

On failure, returns one of the generic describe_parameter errors or:

Query Processing States

Valid in:
  • Annotation state
  • Query Optimization state

Example

void UDF_CALLBACK my_tpf_proc_describe( a_v4_extfn_proc_context *ctx )
{
	if( ctx->current_state == EXTFNAPIV4_STATE_ANNOTATION ) {
		a_sql_int32	rc = 0;
		a_v4_extfn_column_list pbcol = 
		{ 1,		// 1 column in the partition by list
		2 };	// column index 2 requires partitioning

		// Describe partitioning for argument 1 (the table)
		rc = ctx->describe_parameter_set( 
		ctx, 1, 
		EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY, 
		&pbcol, 
		sizeof(pbcol) );

		if( rc == 0 ) {
		ctx->set_error( ctx, 17000, 
			“Runtime error, unable set partitioning requirements for column.” );
		}
	}
}
Related concepts
Query Processing States
Partitioning Input Data
Related reference
EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY (Get)
Generic describe_parameter Errors
V4 API describe_parameter and EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY
Parallel TPF PARTITION BY Examples Using EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY