Lag (time elapsed)

hi there, is any out of the box function like LAG in SQL that helps to obtain a previous record value on my function to compare and estimate differences?
i.e. Time elapsed between logs

Thanks & best regards,


OpenSearch SQL operates on each row separately, so i don’t think it supports calculating time diff with previous record value. I felt this might require non-trivial change to SQL engine, but i might be wrong and feel free to create a feature request in SQL repo Issues · opensearch-project/sql · GitHub. We can evaluate or see if there are alternatives

@davidchar LAG is one of the analytics window functions which are not supported yet: sql/window.rst at main · opensearch-project/sql · GitHub. As documented, only aggregate and ranking window functions are supported for now. Will open an issue for this feature request. Thanks!