You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While the standard lead/lag window functions are very useful, they can be cumbersome to work with, for instance to get a delta I'd have to do something like:
SELECT lead(value) OVER (PARTITION BY id ORDER BY time) - value FROM foo
While that's okay, it gets a little confusing syntactically when you are doing lots of operations on windowed values as the window clauses tend to end up making the syntax a bit confusing, providing convenience functions like SELECT delta(value) OVER (PARTITION BY id ORDER BY time) FROM foo would make them easier to work with in some situations.
List of possible additions as we think of them: delta - difference between this value and next, possible optional parameter or different name for lead/lag (for all of these?) change - boolean returning whether the value changed, possibly with a second optional parameter specifying the magnitude of the change increase/decrease - similar to change except signed
The text was updated successfully, but these errors were encountered:
While the standard
lead
/lag
window functions are very useful, they can be cumbersome to work with, for instance to get a delta I'd have to do something like:SELECT lead(value) OVER (PARTITION BY id ORDER BY time) - value FROM foo
While that's okay, it gets a little confusing syntactically when you are doing lots of operations on windowed values as the window clauses tend to end up making the syntax a bit confusing, providing convenience functions like
SELECT delta(value) OVER (PARTITION BY id ORDER BY time) FROM foo
would make them easier to work with in some situations.List of possible additions as we think of them:
delta
- difference between this value and next, possible optional parameter or different name for lead/lag (for all of these?)change
- boolean returning whether the value changed, possibly with a second optional parameter specifying the magnitude of the changeincrease
/decrease
- similar to change except signedThe text was updated successfully, but these errors were encountered: