You can use describe_parameter_set and describe_parameter_get for partitioning an input table parameter for required columns.
The describe_parameter API has two declarations.
a_sql_int32 (SQL_CALLBACK *describe_parameter_set)( a_v4_extfn_proc_context *cntxt, a_sql_uint32 arg_num, a_v4_extfn_describe_parm_type describe_type, void *describe_buffer, size_t describe_buffer_ )
a_sql_int32 (SQL_CALLBACK *describe_parameter_get)( a_v4_extfn_proc_context *cntxt, a_sql_uint32 arg_num, a_v4_extfn_describe_parm_type describe_type, const void *describe_buffer, size_t describe_buffer_ )
In order to use these APIs, the arg_num must refer to a TABLE parameter, and the describe_buffer must refer to the type of memory block a_v4_extfn_column_list structure.
typedef struct a_v4_extfn_column_list { a_sql_int32 number_of_columns; a_sql_uint32 column_indexes[1]; } a_v4_extfn_column_list;
Positive integer N, where N indicates the number of columns present in the partition by list.
0, which indicates PARTITION BY ANY.
-1, which indicates NO PARTITION BY.
This enumerated type is defined in the extfnapiv4.h header file:
typedef struct a_v4_extfn_column_list { a_sql_int32 number_of_columns; a_sql_uint32 column_indexes[1]; } a_v4_extfn_column_list;
You can use the v4_extfn_partitionby_col_num enumerated type to build the column list structure and execute the describe_parameter_set and describe_parameter_get API to inform the server of its requirements and to determine which input columns have been partitioned. The execution of describe_parameter_set and describe_parameter_get APIs can have following scenarios:
column Index Scenarios | Description |
---|---|
{ 1, 1 } | Input table column #1 is partitioned as per UDF request. |
{ 2, 3, 1 } | Input table columns #3 and #1 are partitioned as per UDF request. |
{ 0 } | UDF can support any form of input table partitioning as per UDF request. |
column Index Scenarios | Description |
---|---|
{ 1, 2 } | Input table column #2 is being partitioned on. |
{ 2, 1, 2} | Input table columns #1 and #2 are being partitioned on. |
{ 0 } | Input table being partitioned by a noncolumn based scheme. |
NULL | No runtime partitioning is provided. |