我想在 DolphinDB 的流聚合器中使用用户定义的函数。
但是它返回一个异常,我不知道如何处理它:
def mymid(vec){
return (first(vec) + last(vec))/2
}
share streamTable(10000:0, `time`device`metric, [TIMESTAMP, SYMBOL, DOUBLE] as sensor
output = table(10000:0, `time`mymid, [TIMESTAMP, DOUBLE]);
aggregator = createStreamAggregator("aggregator", 120, 60, <mymid(metric)>, sensor, output, `time)
execution was completed with exception
Usage: createStreamAggregator(name, windowSize, step, metrics, dummyTable, outputTable, timeColumn, [useSystemTime=false], [keyColumn], [garbageSize]).
the outermost meta code must be aggregated functions.
显然mymid
是一个聚合函数。我的问题是如何在 DolphinDB 中创建聚合的用户定义函数?