V4 API describe_parameter and EXTFNAPIV4_DESCRIBE_PARM_TABLE_PARTITIONBY

You can use describe_parameter_set and describe_parameter_get for partitioning an input table parameter for required columns.

Declaration

The describe_parameter API has two declarations.

describe_parameter_set Declaration

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_
            )

describe_parameter_get Declaration

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_
            )

Usage

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;
The structure field number_of_columns must have one of these values:
  • 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:

describe_parameter_set 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.

describe_parameter_get Scenarios

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.
Note: A PARTITION BY expression other than PARTITION BY ANY or PARTITION BY NONE must appear in the select list for the input query.
Related reference
Describe API
Partition By Column Number (a_v4_extfn_partitionby_col_num)
EXTFNAPIV4_DESCRIBE_PARM_TYPE Attribute (Get)
EXTFNAPIV4_DESCRIBE_PARM_TABLE_NUM_COLUMNS Attribute (Get)
EXTFNAPIV4_DESCRIBE_PARM_TYPE Attribute (Set)
EXTFNAPIV4_DESCRIBE_PARM_TABLE_NUM_COLUMNS Attribute (Set)
EXTFNAPIV4_DESCRIBE_COL_TYPE (Get)
EXTFNAPIV4_DESCRIBE_COL_TYPE (Set)