EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY (Get)

The EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY attribute indicates that the UDF requires partitioning. Used in a describe_parameter_get 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. It is the UDF's responsibility to 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:
  • Query Optimization state
  • Plan Building state
  • Execution state

Example

void UDF_CALLBACK my_tpf_proc_describe( a_v4_extfn_proc_context *ctx )
{
	if( ctx->current_state == EXTFNAPIV4_STATE_OPTIMIZATION ) {
		a_sql_uint32	col_count   = 0;
		a_sql_uint32	buffer_size = 0;
		a_v4_extfn_column_list	*clist = NULL;

		col_count = 3;	// Set to the max number of possible pby columns

		buffer_size = sizeof( a_v4_extfn_column_list ) + (col_count - 1) * sizeof( a_sql_uint32 );

		clist = (a_v4_extfn_column_list *)ctx->alloc( ctx, buffer_size );

		clist->number_of_columns = 0;
		clist->column_indexes[0] = 0;
		clist->column_indexes[1] = 0;
		clist->column_indexes[2] = 0;

	args->r_api_rc = ctx->describe_parameter_get( ctx,
		args->p3_arg_num,
	EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY,
	clist,
	buffer_size );
}
}