CSV import doesn't support date parsing
- Lingua principale
- Rust
- Stelle
- 9.3k
- Fork
- 2.4k
- Merge medio
- 3g 11h
- PR unite (30g)
- 360
Descrizione
### Describe the bug
While working on [#13576](https://github.com/apache/datafusion/pull/13576/files#diff-ec9107a0ab3a6acc573a935893a568ff798339bbfde06ee3aeb3ed39cd2f483aR367), I noticed we allow to pass `format.date_format` when reading CSV but ignore that
### To Reproduce
```sql
CREATE EXTERNAL TABLE dates (
date date
) STORED AS CSV
LOCATION 'dates.csv'
OPTIONS ('format.has_header' 'true', 'format.date_format' '%d/%m/%Y');
SELECT * FROM dates;
0 row(s) fetched.
Elapsed 0.014 seconds.
Arrow error: Parser error: Error while parsing value 03/12/2024 for column 0 at line 1
```
[dates.csv](https://github.com/user-attachments/files/17999374/dates.csv)
### Expected behavior
```sql
select to_date('03/12/2024', '%d/%m/%Y');
```
This^ works, so I `date_format` should be supported too?
### Additional context
I believe we currently don't pass the format string when reading csv (because there's no functionality in arrow), only when writing:
https://github.com/apache/arrow-rs/blob/9047d99f6bf87582532ee6ed0acb3f2d5f889f11/arrow-csv/src/reader/mod.rs#L909
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con il percorso di lettura CSV descritto nell’issue ed esamina l’implementazione collegata di arrow-csv reader, soprattutto in corrispondenza del reader code indicato. Riproduci l’esempio CREATE EXTERNAL TABLE con dates.csv e l’opzione date_format, quindi verifica che l’importazione del CSV analizzi 03/12/2024 secondo %d/%m/%Y senza l’errore del parser.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust
- Ambito
- databases
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100