FNC_Context_t Fields | Window Aggregate Functions | Teradata Vantage - 17.10 - FNC_Context_t Fields - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1147-171K
Language
English (United States)

The following table identifies the FNC_Context_t fields that are used by window aggregate functions. If a field is not listed in the table, it is not applicable for window aggregate functions or the field is reserved for future use.

Fields Specifies
version the version of the context structure.
interim1 a pointer to the aggregate storage area that saves intermediate results.
intrm1_length the length of interim1.
window_size
  • For the cumulative window type, this value is -1.
  • For the reporting window type, the value is -2.
  • For the moving window type, the value is set as post_window -pre_window+1 (+1 for the current row).
pre_window This value is specified as part of the PRECEDING clause. The value of this field is negative if this points to a row that precedes the current row.

This field is not applicable for the cumulative and reporting window types. It is initialized to zero in those cases.

post_window This value is specified as part of the FOLLOWING clause. The value of this field is positive if this points to a row that follows the current row.

This field is not applicable for the cumulative and reporting window types. It is initialized to zero in those cases.

Vantage sets up the following fields prior to invoking the function. The fields are used to define a window of rows for the function to operate on.
  • window_size
  • pre_window
  • post_window