Producing the Final Group Result - Analytics Database - Teradata Vantage

SQL External Routine Programming

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantageā„¢

During the AGR_FINAL aggregation phase, a UDF produces the final result for the group. The method must set the result value to the final value.

In the standard deviation example, the method can use the following code to calculate the final value:

double term2 = s1.x_sum/s1.count;
double variance = s1.x_sq/s1.count - term2*term2;

The following statement sets the result value to the final value of the standard deviation:

return new Double(Math.sqrt(variance));