/*PREPARATION*/
CREATE TABLE bug_test (
    date1 DATE,
    some_string VARCHAR(25)
)  ENGINE=COLUMNSTORE DEFAULT CHARSET=UTF8MB4;

DELIMITER $$
CREATE FUNCTION `test_function`(input_text VARCHAR(25)) RETURNS varchar(25) CHARSET latin1
    DETERMINISTIC
begin
return input_text;
end$$
DELIMITER ;

INSERT INTO bug_test(date1, some_string) VALUES(now(),'xyz');


/*TEST CASES*/

/*Selecting date works fine*/
SELECT 
    date1
FROM
    bug_test;

/*THE BUG: date is malformatted if the date column returns within IF() function*/
SELECT 
    IF(True, date1, NULL)
FROM
    bug_test;

/*It works with CASE*/
SELECT 
    CASE
        WHEN TRUE THEN date1
        ELSE NULL
    END
FROM
    bug_test;
