Affects Version/s: None
Fix Version/s: None
LAST_VALUE Windowing function has been returning bad results, as far as I can tell from day 1.
And, it seems like the tests are also asserting that LAST_VALUE gives the wrong result.
The query is:
The result is:
LAST_VALUE( i ) should have returned 65549 in both records, instead it simply ends up returning i.
Another way you can make sure LAST_VALUE is bad is to verify it's result against LEAD(i,1) over (partition by t order by s). LAST_VALUE being last value should always be more (in terms of the specified 'order by s') than the lead by 1. While this doesn't directly apply to the above query, if the result set had more rows, you would clearly see records where lead is higher than last_value which is semantically incorrect.