support more date inferences in the csv reader
- 主要言語
- Rust
- スター
- 9.3k
- フォーク
- 2.4k
- 平均マージ
- 3日 11時間
- マージ済み PR(30日)
- 360
説明
### 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_
コントリビューションガイド
調査の方向性
レポートに示された CSV の例と SQL 型検査クエリを使って問題を再現します。yyyy-mm-dd 列に対する CSV リーダーの既存の日付推論を追跡し、要求された形式をどのように区別すべきかを判断します。特に、日と月が曖昧になる場合が対象です。完了条件は、意図した形式が一貫して推論され、テストでカバーされていることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust
- 領域
- data-engineering
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 35/100