时序引擎的自定义函数中,第一个进来的窗口长度为0 ,导致错误

时序引擎的自定义函数中,第一个进来的窗口长度为0 ,导致自定义函数里一些因子的计算出现错误:

update ticks set sx2=0..size(t.lastprice)-------------------A
update ticks set sx2=0..size(t.lastprice) take -size(t.lastprice)------------------B

自定义函数参数中有p_arr,  然后我ticks=table(p_arr as lastprie)

用A因子这样写法会报错

tse1 = createTimeSeriesEngine("tse1", 300000000000, 1000000000, tsoselected_metrics, pankou, tso_info, "datetime", , "symbol") => Usage: createTimeSeriesEngine(name, windowSize, step, metrics, dummyTable, outputTable, [timeColumn], [useSystemTime=false], [keyColumn], [garbageSize], [updateTime], [useWindowStartTime], [roundTime=true], [snapshotDir], [snapshotIntervalInMsgCount], [fill='NONE'], [forceTriggerTime], [raftGroup]). The number of rows to update doesn't match the length of new values.

用B因子的写法可以正确运行。


我tse 的参数windowSize=100000000000,step=1000000000   timcColumn=`datetime

上游表第一条数据的datetime=2022.02.14 10:05:35.000000000 类型是nanotimestamp

如何改进使得 我用A因子那种写法也能正常运行?

让第一次进来的窗口长度不要为0,或者

进来的窗口为0, 但该次时序聚合计算不返回任何东西

请先 登录 后评论

1 个回答

Flying - It's IT!

完全可以检测到长度为0就直接返回空结果

请先 登录 后评论
  • 1 关注
  • 0 收藏,910 浏览
  • ddbuserex 提出于 2022-07-12 12:56

相似问题