duckdb / duckdb_spatial

MIT License
493 stars 41 forks source link

feature request: force casting when necessary #247

Closed aborruso closed 10 months ago

aborruso commented 10 months ago

Hi, I have these two files:

If I do a JOIN

COPY (
    SELECT w.*, n.*
    FROM st_read('layer.geojson') w
    LEFT JOIN read_csv_auto('table.csv') n ON w.POSTAL = n."ISO_3166-1"
    ORDER BY POSTAL
) TO 'test_1.geojson' WITH (FORMAT 'GDAL', DRIVER 'GeoJSON')

I have this error

Error: near line 1: Not implemented Error: Unsupported field type

And I have it, because I have a date field in the CSV. If I remove the field Data_Report, I have no error.

I had to do some testing to figure out what the problem was, and this is an example with a few fields. It would be optimal to have casting forcing for those fields not compatible with the output. An option that forces the field type to text, for non-compatible fields, without having to list them in hard coding.

I am not able to help with code writing, sorry. I report here simply my user experience.

Thank you

Maxxen commented 10 months ago

Hi! Thanks for reporting this issue. This is a known problem, not all data types are supported when reading from GDAL yet, most notably dates and timestamps. I will look into fixing it properly.