-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The to_char function in DataFusion returns NULL when formatting valid DATE values
To Reproduce
cargo run -p datafusion-cli -- -c "SELECT to_char(date_column, '%Y-%m-%d') FROM (VALUES (NULL), (DATE '2020-09-01')) AS t(date_column)"
+-----------------------------------------+
| to_char(t.date_column,Utf8("%Y-%m-%d")) |
+-----------------------------------------+
| NULL |
| NULL |
+-----------------------------------------+
Expected behavior
+-----------------------------------------+
| to_char(t.date_column,Utf8("%Y-%m-%d")) |
+-----------------------------------------+
| NULL |
| 2020-09-01 |
+-----------------------------------------+
Additional context
I discovered this bug while trying to add this slt test
SELECT to_char(date_column, '%Y-%m-%d')
FROM (VALUES
(DATE '2020-09-01'),
(NULL)
) AS t(date_column);Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working