16.20 - Function Context Parameter - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

As discussed in Aggregate Function Parameter List , the aggregate UDF parameter list includes a pointer to an FNC_Context_t function context structure, which is defined as:

struct FNC_Context_t {
    int         version;
    FNC_flags_t flags;
    void        *interim1;
    int         intrm1_length;
    void        *interim2;
    int         intrm2_length;
    long        group_count;
    long        window_size;
    long        pre_window;
    long        post_window;
} FNC_Context_t;

The function should treat the structure as read only, and must never change any of its values. The structure has four members that are used for intermediate storage in aggregate functions.

Member … Specifies …
interim1 a pointer to the aggregate storage area in which the function saves intermediate results.
interim2 a pointer to an intermediate storage area to combine with the interim1 storage area when the value of aggregation phase is AGR_COMBINE.
intrm1_length the length of interim1.
intrm2_length the length of interim2.