This Operator can be used to update the timestamp information in the meta data part. It can be used, if the generell Window operator does not help.
Be careful because this may lead undefined semantics.
/// Example using attributes for timestamp output = Timestamp({year='year', month='month', day='day', hour='hour', minute='minute', second='second', millisecond='millisecond'}, input) /// Example using date format output = Timestamp({start='timestamp', dateformat='EEE MMM dd HH:mm:ss zzz yyyy'}, input) /// Example with german time stamps output = Timestamp({start='timestamp',dateformat = 'dd.MM.yyyy HH:mm:ss'}, input) /// Simulate an Expression based window: output = Timestamp({start='start', end = 'start+1000'},input) /// Create windows starting at distinct points in time, e.g. a "month"-based window (where the input attribute timestamp is a String based date representation): ouput = TIMESTAMP({START = 'toLong(monthStart(toDate(timestamp,"dd.MM.yyyy")))', END = 'toLong(nextMonthStart(toDate(timestamp,"dd.MM.yyyy")))'},input) |
Remark: This operator can be used to update the end time stamp in cases where system time is used also (de.uniol.inf.is.odysseus.core.server.planmanagement.TransformationException: transformation failed ; You cannot use start and end parameters for system time processing). In this case simply use the operator with systemtime=false:
map = MAP({EXPRESSIONS = [['TimeInterval.Start+1000','EndTS']], KEEPINPUT = true}, nexmark:person) out = TIMESTAMP({end='EndTS', SYSTEMTIME = false}, map) |
Sometimes there are problem with some date string. The following example from Tankerkoenig data shows how to handle such cases:
#PARSER PQL #ADDQUERY in = CSVFILESOURCE({ schema = [ ['date', 'STRING'], ['station_uuid','STRING'], ['diesel','FLOAT'], ['e5','FLOAT'], ['e10','FLOAT'], ['dieselchange','BOOLEAN'], ['e5change','BOOLEAN'], ['e10change','BOOLEAN'] ], READFIRSTLINE = false, filename = 'D:/tankerkoenig-data/prices/2023/01/2023-01-01-prices.csv', source = 'Tanker-2023-01-01' } ) /// E.g. if you want to remove +01 from 2023-01-01 00:00:10+01 yyyy-MM-DD HH:mm:ssZ tsCorrected = TIMESTAMP({START = 'toTimestamp(substring(date,0,19),"yyyy-MM-dd HH:mm:ss")'}, in) |