alamb commented on issue #4876:
URL: 
https://github.com/apache/arrow-datafusion/issues/4876#issuecomment-1379467109

   ```shell
   (arrow_dev) alamb@MacBook-Pro-8:~/Software/influxdb_iox2$ cat /tmp/data.csv 
   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
   ```
   
   You are correct that extract is now a `float` -- I think that was on purpose 
to match posgres: https://github.com/apache/arrow-datafusion/issues/3997
   
   
   ```shell
   (arrow_dev) alamb@MacBook-Pro-8:~/Software/influxdb_iox2$ datafusion-cli 
   DataFusion CLI v16.0.0
   ❯ select * from '/tmp/data.csv';
   +-----------+-------------------------+-------------+
   | 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  |
   +-----------+-------------------------+-------------+
   5 rows in set. Query took 0.020 seconds.
   ❯ SELECT d.name, arrow_typeof(EXTRACT(YEAR FROM d.created_at)) as year, 
d.last_report + INTERVAL '12' MONTH as deadline FROM '/tmp/data.csv' d ORDER BY 
d.created_at;
   +-----------+---------+------------+
   | name      | year    | deadline   |
   +-----------+---------+------------+
   | Sales     | Float64 | 2023-08-29 |
   | Finance   | Float64 | 2022-09-14 |
   | Marketing | Float64 | 2023-02-16 |
   | HR        | Float64 | 2023-03-01 |
   | IT        | Float64 | 2022-04-04 |
   +-----------+---------+------------+
   ❯ 
   ```
   
   Perhaps you can add a workaround by explicitly casting to numeric:
   
   ```text
   ❯ SELECT d.name, EXTRACT(YEAR FROM d.created_at)::int as year, d.last_report 
+ INTERVAL '12' MONTH as deadline FROM '/tmp/data.csv' d ORDER BY d.created_at;
   ```
   


-- 
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: github-unsubscr...@arrow.apache.org

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

Reply via email to