DDtKey opened a new issue, #4876:
URL: https://github.com/apache/arrow-datafusion/issues/4876

   **Describe the bug**
   `write_csv` result contains unexpected format for `EXTRACT(YEAR FROM ...)`. 
It looks like floating number for some reason.
   
   **To Reproduce**
   Example of file:
   ```
   name,created_at,last_report
   Sales,1825-08-29T07:29:01.256,2022-08-29
   Marketing,2017-02-16T07:29:01.256,2022-02-16
   IT,2019-04-04T07:29:01.256,2021-04-04
   Finance,2016-09-14T07:29:01.256,2021-09-14
   HR,2017-03-01T07:29:01.256,2022-03-01
   ```
   SQL:
   
   ```sql
   SELECT d.name, EXTRACT(YEAR FROM d.created_at) as year, d.last_report + 
INTERVAL '12' MONTH as deadline FROM deps d ORDER BY d.created_at
   ```
   
   It returns:
   ```
   name,year,deadline
   Sales,1825.0,2023-08-29
   Finance,2016.0,2022-09-14
   Marketing,2017.0,2023-02-16
   HR,2017.0,2023-03-01
   IT,2019.0,2022-04-04
   ```
   So result of `EXTRACT(YEAR FROM d.created_at) as year` has floating format 
for some reason. 
   
   While `data_frame.show()` works expected:
   ```
   +-----------+------+------------+
   | name      | year | deadline   |
   +-----------+------+------------+
   | Sales     | 1825 | 2023-08-29 |
   | Finance   | 2016 | 2022-09-14 |
   | Marketing | 2017 | 2023-02-16 |
   | HR        | 2017 | 2023-03-01 |
   | IT        | 2019 | 2022-04-04 |
   +-----------+------+------------+
   
   ```
   
   **Expected behavior**
   Result should be consistent with `show` and previous version `datafusion 
15.0.0` (it used to work) 
   
   **Additional context**
   Add any other context about the problem here.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to