-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
range between
seems to not support lag()
#23742
Comments
For functions such as lead and lag, the window frame is not supported. Per the SQL specification:
The invocation should fail if the window frame is present. Currently, it's being ignored. That's a bug. |
@emmansh which version of Trino are you running? I've written a test to verify whether the window frame is supported for the lag function: link. It shows that the current master behaves as expected, returning the error However, for functions like |
Hi, may i ask is this issue still open? can i work on this? |
Hi @yuma-tietiedaxiang, I started looking at this. However, I'm waiting for a response from @emmansh (see my last comment). |
@piotrrzysko I use Trino via AWS Athena. I'm not sure what Trino version it uses, but it certainly not the latest. |
I verified this, and indeed, Athena returns the results provided by @emmansh. However, the current version of Trino throws an error for the |
Cross posted at Stack Overflow.
I want to get the previous value using
lag()
, over a partition defined withRANGE BETWEEN
. I followed an example from the documentation:It returns:
The problem: while the calculation for
past_month_avg
results as expected, theprevious_total_price_within_last_month
result is not as expected.Expected Output
Given that I defined a window that ranges at the last month, I expect that
lag()
will returnnull
if the "previous"totalprice
value is associated with anorderdate
value that is out of the 1-month-back window.*expected value
Does
ranges between
not supportlag()
, or is my example actually demonstrating the expected behavior?The text was updated successfully, but these errors were encountered: