TD_SAX Examples - Teradata Vantage

Database Unbounded Array Framework Time Series Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
ncd1634149624743.ditamap
dita:ditavalPath
ruu1634160136230.ditaval
dita:id
ncd1634149624743

Example: TD_SAX Call with WINDOW_TYPE Global and POINTS_PER_SYMBOL

EXECUTE FUNCTION INTO VOLATILE ART(outstr)
  TD_SAX(
     SERIES_SPEC(
       TABLE_NAME(finance_data3),
       ROW_AXIS(SEQUENCE(period)),
       SERIES_ID(id),
       PAYLOAD(FIELDS(expenditure, income, investment), CONTENT(MULTIVAR_REAL))
) 
     WHERE id = 3,
     FUNC_PARAMS(
       WINDOW_TYPE(GLOBAL),
       OUTPUT_TYPE(STRING),
       POINTS_PER_SYMBOL(2),
       ALPHABET_SIZE(10),
       CODE_STATS(1),
       MEAN(2045.166666,2387.416666,759.083333),
       STD_DEV(256.612489,317.496587,113.352594) )
);

TD_SAX Output

SELECT * FROM outstr;
id 3
ROW_I 0
SAX_Code_expenditure  abghhh
Mean_expenditure      2.04516666600000E 003
Std_dev_expenditure   2.56612489000000E 002
SAX_Code_income       abghhh
Mean_income           2.38741666600000E 003
Std_dev_income        3.17496587000000E 002
SAX_Code_investment   aahhgh
Mean_investment       7.59083333000000E 002
Std_dev_investment    1.13352594000000E 002

Example: TD_SAX Call with WINDOW_TYPE Sliding and SYMBOLS_PER_WINDOW

EXECUTE FUNCTION INTO VOLATILE ART(outstr)
  TD_SAX(
     SERIES_SPEC(
     TABLE_NAME(finance_data3),
     ROW_AXIS(SEQUENCE(period)),
     SERIES_ID(id),
     PAYLOAD(FIELDS(expenditure, income, investment), CONTENT(MULTIVAR_REAL))
  )
  WHERE id = 3,
  FUNC_PARAMS(
     WINDOW_TYPE(SLIDING),
     WINDOW_SIZE(4),
     SYMBOLS_PER_WINDOW(5),
     CODE_STATS(1)
  )
);

TD_SAX Output

SELECT * FROM outstr;
id 3
ROW_I 0
SAX_Code_expenditure  abccd
Mean_expenditure      1.70225000000000E 003
Std_dev_expenditure   4.43198601080825E 001
SAX_Code_income       abbcd
Mean_income           1.96175000000000E 003
Std_dev_income        4.61762926186155E 001
SAX_Code_investment   caabd
Mean_investment       6.07500000000000E 002
Std_dev_investment    9.57427107756338E 000

id 3
ROW_I 1
SAX_Code_expenditure  bbbcd
Mean_expenditure      1.82600000000000E 003
Std_dev_expenditure   2.14424811997119E 002
SAX_Code_income       bbbcd
Mean_income           2.11450000000000E 003
Std_dev_income        2.72732469647455E 002
SAX_Code_investment   bbbcd
Mean_investment       6.63000000000000E 002
Std_dev_investment    1.13713089249508E 002

id 3
ROW_I 2
SAX_Code_expenditure  aacdd
Mean_expenditure      1.94575000000000E 003
Std_dev_expenditure   2.41479295178696E 002
SAX_Code_income       aacdd
Mean_income           2.26500000000000E 003
Std_dev_income        3.10089234468618E 002
SAX_Code_investment   aabdd
Mean_investment       7.28750000000000E 002
Std_dev_investment    1.36568358951357E 002

id 3
ROW_I 3
SAX_Code_expenditure  abccc
Mean_expenditure      2.06675000000000E 003
Std_dev_expenditure   2.11375455844176E 002
SAX_Code_income       abccc
Mean_income           2.41600000000000E 003
Std_dev_income        2.66436984419706E 002
SAX_Code_investment   abccc
Mean_investment       7.95500000000000E 002
Std_dev_investment    1.18699901712961E 002

id 3
ROW_I 4
SAX_Code_expenditure  aacdd
Mean_expenditure      2.18500000000000E 003
Std_dev_expenditure   3.68872154908264E 001
SAX_Code_income       abbcd
Mean_income           2.56650000000000E 003
Std_dev_income        4.31161222746202E 001
SAX_Code_investment   acdca
Mean_investment       8.48250000000000E 002
Std_dev_investment    1.98053023203384E 001

id 3
ROW_I 5
SAX_Code_expenditure  abccd
Mean_expenditure      2.20750000000000E 003
Std_dev_expenditure   3.13953287395859E 001
SAX_Code_income       abcdd
Mean_income           2.59600000000000E 003
Std_dev_income        4.19602986961088E 001
SAX_Code_investment   cdcba
Mean_investment       8.40250000000000E 002
Std_dev_investment    3.12022969239980E 001

id 3
ROW_I 6
SAX_Code_expenditure  abcdd
Mean_expenditure      2.22575000000000E 003
Std_dev_expenditure   1.41745076340121E 001
SAX_Code_income       abcdc
Mean_income           2.61425000000000E 003
Std_dev_income        2.47167284782324E 001
SAX_Code_investment   dcbab
Mean_investment       8.31250000000000E 002
Std_dev_investment    2.86981416355368E 001

id 3
ROW_I 7
SAX_Code_expenditure  abbcd
Mean_expenditure      2.23675000000000E 003
Std_dev_expenditure   1.02753750945322E 001
SAX_Code_income       bdcbc
Mean_income           2.62625000000000E 003
Std_dev_income        9.53502316025854E 000
SAX_Code_investment   cabcd
Mean_investment       8.21500000000000E 002
Std_dev_investment    1.40118997046558E 001

id 3
ROW_I 8
SAX_Code_expenditure  aabcd
Mean_expenditure      2.24825000000000E 003
Std_dev_expenditure   1.65604951616792E 001
SAX_Code_income       caabd
Mean_income           2.63400000000000E 003
Std_dev_income        1.42126704035519E 001
SAX_Code_investment   abccc
Mean_investment       8.21500000000000E 002
Std_dev_investment    1.40118997046558E 001