TD_BINARYSERIESOP Function Examples | Teradata Vantage - TD_BINARYSERIESOP 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: D_BINARYSERIESOP Call with ONE2ONE Subtraction

EXECUTE FUNCTION COLUMNS(OUT_Magnitude AS Magnitude) INTO VOLATILE ART(DETREND_STOCK)
TD_BINARYSERIESOP( 
   SERIES_SPEC(
      TABLE_NAME(StockDataSet), 
      SERIES_ID(DataSetID), ROW_AXIS(SEQUENCE(SeqNo)),
      PAYLOAD(FIELDS(Magnitude), CONTENT(REAL))
   ) 
   WHERE DataSetID=556 AND SeqNo BETWEEN 3 and 50,

   SERIES_SPEC(TABLE_NAME(SMOOTH_SERIES), SERIES_ID(DataSetID),  
      ROW_AXIS(SEQUENCE(ROW_I)),
      PAYLOAD(FIELDS(Magnitude), CONTENT(REAL))
   ) 
   WHERE DataSetID=556 AND ROW_I BETWEEN 2 and 49,

   FUNC_PARAMS(MATHOP("SUB")),
   INPUT_FMT(INPUT_MODE(ONE2ONE)) );

TD_BINARYSERIESOP Output with ONE2ONE Subtraction

SELECT * FROM DETREND_STOCK;
DataSetID ROW_I Magnitude
--------- ----- ---------------------
556       0     -1.056801
556       1     1.0329300000000003
556       2     0.18568799999999896
556       3     -0.26065500000000696
556       4     0.8970369999999974
556       5     -0.4672510000000045
556       6     -0.08170000000000499
556       7     -0.12961800000000778
...

Example: TD_BINARYSERIESOP Call with MANY2ONE Subtraction

EXECUTE FUNCTION INTO VOLATILE ART(MATHEXAMPLE)
TD_BINARYSERIESOP(
   SERIES_SPEC( 
      TABLE_NAME(BINARY_COMPLEX_LEFT), 
      ROW_AXIS(SEQUENCE(SEQ)), 
      SERIES_ID(ID),
      PAYLOAD(FIELDS(REAL_VAL,IMAGINARY_VAL), CONTENT(COMPLEX)) 
    ) ,

   SERIES_SPEC( 
      TABLE_NAME(BINARY_COMPLEX_RIGHT), 
      ROW_AXIS(SEQUENCE(SEQ)), 
      SERIES_ID(ID),
      PAYLOAD(FIELDS(REAL_VAL,IMAGINARY_VAL), CONTENT(COMPLEX)) 
    )
    WHERE ID=1,
    FUNC_PARAMS( MATHOP(SUB) ),
    INPUT_FMT(INPUT_MODE(MANY2ONE))
);

TD_BINARYSERIESOP Output

Display the RETURNS TABLE with this statement:

SELECT * FROM MATHEXAMPLE;
ID ROW_I OUT_REAL_VAL OUT_IMAGINARY_VAL
--------------------------------------------------------------
1 0 2.20000000000000E 000 2.02000000000000E 001
1 1 2.40000000000000E 000 2.04000000000000E 001
1 2 2.60000000000000E 000 2.06000000000000E 001
1 3 2.80000000000000E 000 2.08000000000000E 001
1 4 3.00000000000000E 000 2.10000000000000E 001
2 0 6.20000000000000E 000 6.02000000000000E 001
2 1 6.40000000000000E 000 6.04000000000000E 001
2 2 6.60000000000000E 000 6.06000000000000E 001
2 3 6.80000000000000E 000 6.08000000000000E 001
2 4 7.00000000000000E 000 6.10000000000000E 001

Example: TD_BINARYSERIESOP Call with MATCH Subtraction

EXECUTE FUNCTION INTO VOLATILE ART(MATHEXAMPLE)
TD_BINARYSERIESOP(
   SERIES_SPEC(TABLE_NAME(BINARY_REALS_LEFT), ROW_AXIS(SEQUENCE(SEQ)),SERIES_ID(ID),
      PAYLOAD(FIELDS(A), CONTENT(REAL)) ),
   SERIES_SPEC(TABLE_NAME(BINARY_REALS_RIGHT), ROW_AXIS(SEQUENCE(SEQ)),SERIES_ID(ID),
      PAYLOAD(FIELDS(B), CONTENT(REAL)) ),
   FUNC_PARAMS( MATHOP(SUB) ),
   INPUT_FMT(INPUT_MODE(MATCH)));

TD_BINARYSERIESOP Output

Display the RETURNS TABLE with this statement:

SELECT * FROM MATHEXAMPLE;
ID ROW_I OUT_A
-----------------------------------
1 0 -9.00000000000000E 000
1 1 -9.00000000000000E 000
1 2 -9.00000000000000E 000
1 3 -9.00000000000000E 000
1 4 -9.00000000000000E 000
2 0 -4.50000000000000E 001
2 1 -4.50000000000000E 001
2 2 -4.50000000000000E 001
2 3 -4.50000000000000E 001
2 4 -4.50000000000000E 001