benmayersohn opened a new issue, #49855:
URL: https://github.com/apache/doris/issues/49855

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   3.0.3-rc04
   
   ### What's Wrong?
   
   It appears the `ignore_null` argument does nothing in the 
FIRST_VALUE/LAST_VALUE window functions.
   
   Example:
   
   ```sql
   SELECT
     id,
     val,
     LAST_VALUE(val, true) OVER (ORDER BY id ROWS BETWEEN UNBOUNDED PRECEDING 
AND CURRENT ROW) AS last_val
   FROM (
     SELECT 1 AS id, NULL AS val UNION ALL
     SELECT 2, NULL UNION ALL
     SELECT 3, 10 UNION ALL
     SELECT 4, NULL
   ) t;
   ```
   
   This yields:
   
   id | val | last_val
   -- | -- | --
   1 |   |  
   2 |   |  
   3 | 10 | 10
   4 |   |  
   
   The same is true if we use `FIRST_VALUE` and reverse the sort direction:
   
   ```sql
   SELECT
     id,
     val,
     FIRST_VALUE(val, true) OVER (ORDER BY id DESC ROWS BETWEEN CURRENT ROW AND 
UNBOUNDED FOLLOWING) AS last_val
   FROM (
     SELECT 1 AS id, NULL AS val UNION ALL
     SELECT 2, NULL UNION ALL
     SELECT 3, 10 UNION ALL
     SELECT 4, NULL
   ) t ORDER BY id;
   ```
   
   This yields the same output:
   
   id | val | last_val
   -- | -- | --
   1 |   |  
   2 |   |  
   3 | 10 | 10
   4 |   |  
   
   
   
   ### What You Expected?
   
   I expected the value 10 to be carried forward to the 4th row, i.e:
   
   
   id | val | last_val
   -- | -- | --
   1 |   |
   2 |   |
   3 | 10 | 10
   4 | | 10
   
   
   ### How to Reproduce?
   
   Run the example query and observe the issue.
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to