You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "universalmind303 (via GitHub)" <gi...@apache.org> on 2024/02/24 05:27:42 UTC

[I] support more date inferences in the csv reader [arrow-datafusion]

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

   ### Is your feature request related to a problem or challenge?
   
   given a csv 
   ```csv
   mm/dd/yyyy,mm-dd-yyyy,dd/mm/yyyy,dd-mm-yyyy,yyyy/mm/dd,yyyy-mm-dd
   01/01/2012,01-01-2012,01/01/2012,01-01-2012,2012/01/01,2012-01-01
   02/02/2013,02-02-2013,02/02/2013,02-02-2013,2013/02/02,2013-02-02
   03/03/2014,03-03-2014,03/03/2014,03-03-2014,2014/03/03,2014-03-03
   04/04/2015,04-04-2015,04/04/2015,04-04-2015,2015/04/04,2015-04-04
   05/05/2016,05-05-2016,05/05/2016,05-05-2016,2016/05/05,2016-05-05
   06/06/2017,06-06-2017,06/06/2017,06-06-2017,2017/06/06,2017-06-06
   07/07/2018,07-07-2018,07/07/2018,07-07-2018,2018/07/07,2018-07-07
   ```
   currently only the last column will get converted to a `Date32`
   
   ```sql
   ❯ SELECT
     arrow_typeof("mm/dd/yyyy") AS "mm/dd/yyyy",
     arrow_typeof("mm-dd-yyyy") AS "mm-dd-yyyy",
     arrow_typeof("dd/mm/yyyy") AS "dd/mm/yyyy",
     arrow_typeof("dd-mm-yyyy") AS "dd-mm-yyyy",
     arrow_typeof("yyyy/mm/dd") AS "yyyy/mm/dd",
     arrow_typeof("yyyy-mm-dd") AS "yyyy-mm-dd"
   from 'testdata/csv/dates.csv' limit 1;
   +------------+------------+------------+------------+------------+------------+
   | mm/dd/yyyy | mm-dd-yyyy | dd/mm/yyyy | dd-mm-yyyy | yyyy/mm/dd | yyyy-mm-dd |
   +------------+------------+------------+------------+------------+------------+
   | Utf8       | Utf8       | Utf8       | Utf8       | Utf8       | Date32     |
   +------------+------------+------------+------------+------------+------------+
   ```
   
   ### Describe the solution you'd like
   
   it'd be nice to auto detect more of these formats. I thought at the very least `YYYY/MM/DD` or `DD/MM/YYYY` would be valid as they are both extremely common. 
   
   
   
   ### Describe alternatives you've considered
   
   there really arent any good alternatives as there aren't any ergonomic ways to cast the utf8 field to date32 through the sql interface. 
   
   ### Additional context
   
   _No response_


-- 
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-unsubscribe@arrow.apache.org.apache.org

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


Re: [I] support more date inferences in the csv reader [arrow-datafusion]

Posted by "Lordworms (via GitHub)" <gi...@apache.org>.
Lordworms commented on issue #9331:
URL: https://github.com/apache/arrow-datafusion/issues/9331#issuecomment-1962366556

   take


-- 
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-unsubscribe@arrow.apache.org

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


Re: [I] support more date inferences in the csv reader [arrow-datafusion]

Posted by "Lordworms (via GitHub)" <gi...@apache.org>.
Lordworms commented on issue #9331:
URL: https://github.com/apache/arrow-datafusion/issues/9331#issuecomment-1970226341

   filed https://github.com/apache/arrow-rs/pull/5444#issue-2160169292 to solve it.


-- 
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-unsubscribe@arrow.apache.org

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


Re: [I] support more date inferences in the csv reader [arrow-datafusion]

Posted by "Lordworms (via GitHub)" <gi...@apache.org>.
Lordworms commented on issue #9331:
URL: https://github.com/apache/arrow-datafusion/issues/9331#issuecomment-1962770484

   This has better to be done in arrow-rs, I would open a PR there


-- 
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-unsubscribe@arrow.apache.org

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


Re: [I] support more date inferences in the csv reader [arrow-datafusion]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #9331:
URL: https://github.com/apache/arrow-datafusion/issues/9331#issuecomment-1968867295

   > This has better to be done in arrow-rs, I would open a PR there
   
   @Lordworms  I suggest you (or someone) file a ticket in arrow-rs to track this work. I agree it would be best done there


-- 
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-unsubscribe@arrow.apache.org

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