Window Aggregate Functions Result Type and Format - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

The result data type and format for window aggregate functions are as follows.

Function Result Type Format
AVG(x)

where x is a character type

FLOAT Default format for FLOAT
AVG(x)

where x is a numeric, DATE, or INTERVAL type

FLOAT Same format as operand x
  • CORR(x,y)
  • COVAR_POP(x,y)
  • COVAR_SAMP(x,y)
  • REGR_AVGX( y,x)
  • REGR_AVGY( y,x)
  • REGR_INTERCEPT(x,y)
  • REGR_R2(x,y)
  • REGR_SLOPE(x,y)
  • REGR_SXX(x,y)
  • REGR_SXY(x,y)
  • REGR_SYY(x,y)
  • STDDEV_POP(x,)
  • STDDEV_SAMP(x,)
  • VAR_POP(x,)
  • VAR_SAMP(x)

where x is a character type

FLOAT Default format for FLOAT
  • CORR(x,y)
  • COVAR_POP(x,y)
  • COVAR_SAMP(x,y)
  • REGR_AVGX (y,x)
  • REGR_AVGY( y,x)
  • REGR_INTERCEPT(x,y)
  • REGR_R2(x,y)
  • REGR_SLOPE(x,y)
  • REGR_SXX(x,y)
  • REGR_SXY(x,y)
  • REGR_SYY(x,y)
  • STDDEV_POP(x)
  • STDDEV_SAMP(x)
  • VAR_POP(x)
  • VAR_SAMP(x)
where x is one of the following types:
  • Numeric
  • DATE
  • Interval
Same data type as operand x. Default format for the data type of operand x
REGR_AVGX(y,x)

REGR_AVGY(y, x)

where x is a UDT

  Default format for the data type to which the UDT is implicitly cast.

COUNT(x)

COUNT(*)

REGR_COUNT(x ,y)

where the transaction mode is ANSI

ANSI transaction mode uses DECIMAL because tables frequently have a cardinality exceeding the range of INTEGER.

COUNT(x)

COUNT(*)

REGR_COUNT(x,y)

where the transaction mode is Teradata

INTEGER

Teradata transaction mode uses INTEGER to avoid regression problems.

You can cast the final result of a COUNT window aggregate function. However, the cast is not used as part of the window function computation. Therefore, the cast cannot be used to avoid numeric overflow errors that may occur during the computation.
Default format for INTEGER
MAX(x), MIN(x) Same data type as operand x. Same format as operand x
SUM(x)

where x is a character type

Same as operand x. Default format for FLOAT
SUM(x)

where x is a DECIMAL(n,m) type

DECIMAL(p,m), where p is determined by a system setting. Default format for DECIMAL
SUM(x)

where x is any numeric type other than DECIMAL

Same as operand x. Default format for the data type of the operand