TD_TRACKINGOP Function Examples | Teradata Vantage - TD_TRACKINGOP 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

TD_TRACKINGOP Input Table myTrack

SeqNo TrainID Schedule_Date Source Next_Station Destination GeoTag ArrivalTime DepartureTime
1 210 2022-03-26 Wilmington Claymont Norristown POINT (-75.5536 39.7374) 2022-03-26 10:41:02 2022-03-26 10:4:01
2 210 2022-03-26 Wilmington Marcus Hook Norristown POINT (-75.45059 39.79994) 2022-03-26 10:46:06 2022-03-26 10:47:01
3 210 2022-03-26 Wilmington Highland Ave Norristown POINT (-75.4199 39.82172) 2022-03-26 10:52:05 2022-03-26 10:53:45
... ... ... ... ... ... ... ... ...
25 210 2022-03-26 Wilmington Norristown TC Norristown POINT (-75.30747 40.07137) 2022-03-26 12:28:06 2022-03-26 12:29:01
26 210 2022-03-26 Wilmington Main St Norristown POINT (-75.34562 40.11321) 2022-03-26 12:33:05 2022-03-26 12:34:11
27 210 2022-03-26 Wilmington Elm St Norristown POINT (-75.34864 40.11735) 2022-03-26 12:36:06 2022-03-26 12:37:45

Example: TD_TRACKINGOP Call for Kilometers

EXECUTE FUNCTION INTO VOLATILE ART(myTrack)
TD_TRACKINGOP( 
   SERIES_SPEC( TABLE_NAME(TrainTracking),ROW_AXIS(TIMECODE(ArrivalTime)),
      SERIES_ID(train_id, schedule_date), 
      PAYLOAD (FIELDS(ArrivalTime, DepartureTime, geoTag),
      CONTENT(MULTIVAR_ANYTYPE)) ),
   FUNC_PARAMS(DISTANCE(1), SPEED(1), TIME_SPENT(1), METRIC(1))
);

TD_TRACKINGOP Output in Kilometers

SELECT * FROM myTrack;
train_id 210
schedule_date 16/03/21
ROW_I 0
TRACK_DISTANCE 6.96537534248852E 001
TRACK_PATH LINESTRING (-75.5536 39.7374,-75.4506 39.7999,-75.4199 39.8217,-75.3932 39.8337,-75.3616 39.8489,-75.3317 39.8712,-75.3231
39.88,-75.3124 39.8865,-75.3036 39.8906,-75.29 39.8962,-75.2779 39.9014,-75.271 39.9043,-75.2664 39.9071,-75.2553 39.9127,-75.1912 39.9471,-
75.1837 39.9569,-75.1678 39.9539,-75.1536 39.9555,-75.1499 39.9806,-75.155 39.9934,-75.1933 40.0115,-7
MIN_SPEED 1.28285792249215E 001
AVG_SPEED 5.92746479561341E 001
MAX_SPEED 2.18532040984786E 002
RUN_TIME 7.72333333333333E 001
TRIP_TIME 1.16716666666667E 002

Example: TD_TRACKINGOP Call for Miles

EXECUTE FUNCTION INTO VOLATILE ART(myTrack)
TD_TrackingOp( 
   SERIES_SPEC( TABLE_NAME(TrainTracking),ROW_AXIS(TIMECODE(ArrivalTime)),
      SERIES_ID(train_id, schedule_date),
      PAYLOAD (FIELDS(ArrivalTime, DepartureTime, geoTag),
      CONTENT(MULTIVAR_ANYTYPE)) ),
   FUNC_PARAMS(DISTANCE(1), SPEED(1), TIME_SPENT(1), METRIC(0))
);

TD_TRACKINGOP Output in Miles

SELECT * FROM myTrack;
train_id 210
schedule_date 16/03/21
ROW_I 0
TRACK_DISTANCE 4.32807527656209E 001
TRACK_PATH LINESTRING (-75.5536 39.7374,-75.4506 39.7999,-75.4199 39.8217,-75.3932 39.8337,-75.3616 39.8489,-75.3317 39.8712,-75.3231
39.88,-75.3124 39.8865,-75.3036 39.8906,-75.29 39.8962,-75.2779 39.9014,-75.271 39.9043,-75.2664 39.9071,-75.2553 39.9127,-75.1912 39.9471,-
75.1837 39.9569,-75.1678 39.9539,-75.1536 39.9555,-75.1499 39.9806,-75.155 39.9934,-75.1933 40.0115,-7
MIN_SPEED 7.97129427298945E 000
AVG_SPEED 3.68314880005031E 001
MAX_SPEED 1.35789254306717E 002
RUN_TIME 7.72333333333333E 001
TRIP_TIME 1.16716666666667E 002