Is it expected behavior that MIN() window function in MariaDB/MySQL can return a non-null value from a window with only null values? A minimal example for MariaDB (reproduced with with 10.2 and latest):

DROP TABLE IF EXISTS t;
CREATE TABLE t
(
    id    int unsigned not null,
    value int unsigned null
);
INSERT INTO t
values (1, null);

CREATE OR REPLACE VIEW v
as
select 1                 as id,
       ifnull(null, 999) as value
from t
;

select *,
       MIN(t.value) over (PARTITION BY t.id) as min_t,
       MIN(v.value) over (PARTITION BY t.id) as min_v
from t
         left join v
                   on t.id &gt; v.id
;


It returns

id value id   value min_t min_v
1  null  null null  null  999


bit I would expect it to return

id value id   value min_t min_v
1  null  null null  null  null &lt;-- null instead of 999


because there is only a single row and it has value = null in the window for MIN function. Sure, it is backed by a ifnull() in view's select, but the resulting set has null from a left join with no corresponding row, so it shouldn't be handled by ifnull() in the view, right?

Can this be considered a bug?

MySQL sqlfiddle example comparing using a view vs using nested selects. Nested selects produce the result I expect, using view doesn't.

Comparing to other RDBMS:

Oracle example: both ways work as I expect.

PostgreSQL example: both ways work as I expect.
Reported this as a bug to MariaDB bug tracker:

https://jira.mariadb.org/browse/MDEV-21874