duckdb / duckdb/duckdb-spatial
Cannot read GEOMETRY('OGC:CRS84') columns from parquet — DuckDB 1.5.0
- Dominant language
- C
- Stars
- 708
- Forks
- 96
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 5
Description
## Summary
DuckDB 1.5.0 with spatial extension `8734819` cannot materialise geometry columns from parquet files that encode geometry with CRS `OGC:CRS84` (e.g. OvertureMaps data). `DESCRIBE` and `typeof()` correctly report the type as `GEOMETRY('OGC:CRS84')`, but any query that actually reads the geometry values fails with `Not implemented Error: Unsupported type: "GEOMETRY('OGC:CRS84')"`.
All attempted workarounds (casting, `ST_SetCRS`, `ST_AsWKB`/`ST_GeomFromWKB`, `::BLOB`) also fail.
## Environment
- **DuckDB**: 1.5.0
- **spatial extension**: 8734819
- **httpfs extension**: 74f9540
- **OS**: Linux (also tested on macOS with same result)
## Minimal reproduction
Reads from the public OvertureMaps S3 bucket (no credentials needed with appropriate AWS config, or set `s3_access_key_id`/`s3_secret_access_key`):
```python
import duckdb
print(f"duckdb version: {duckdb.__version__}")
con = duckdb.connect()
con.execute("INSTALL httpfs; LOAD httpfs;")
con.execute("SET s3_region='us-west-2';")
con.execute("INSTALL spatial; LOAD spatial;")
uri = "s3://overturemaps-us-west-2/release/2026-02-18.0/theme=buildings/type=building/*"
for row in con.execute(
"SELECT extension_name, extension_version FROM duckdb_extensions() "
"WHERE extension_name IN ('spatial', 'httpfs')"
).fetchall():
print(f" {row[0]}: {row[1]}")
# 1. DESCRIBE sees the CRS-annotated type — OK
print("\n--- 1. DESCRIBE geometry column ---")
result = con.execute(f"DESCRIBE SELECT geometry FROM read_parquet('{uri}') LIMIT 1").fetchall()
print(f" type: {result[0][1]}")
# 2. SELECT non-geometry column — OK
print("\n--- 2. SELECT bbox (no geometry column) ---")
try:
con.execute(f"SELECT bbox FROM read_parquet('{uri}') LIMIT 1").fetchone()
print(" OK")
except Exception as e:
print(f" FAILED: {e}")
# 3. SELECT geometry — FAILS
print("\n--- 3. SELECT geometry LIMIT 1 ---")
try:
con.execute(f"SELECT geometry FROM read_parquet('{uri}') LIMIT 1").fetchone()
print(" OK")
except Exception as e:
print(f" FAILED: {e}")
# 4. SELECT geometry with bbox WHERE — FAILS
print("\n--- 4. SELECT geometry with bbox WHERE ---")
try:
con.execute(
f"SELECT geometry FROM read_parquet('{uri}') "
"WHERE bbox.xmin <= -78.0 AND bbox.xmax >= -79.0 "
"AND bbox.ymin <= 43.0 AND bbox.ymax >= 42.0 LIMIT 1"
).fetchone()
print(" OK")
except Exception as e:
print(f" FAILED: {e}")
# 5-8. Workaround attempts — all FAIL
workarounds = {
"geometry::GEOMETRY": f"SELECT geometry::GEOMETRY FROM read_parquet('{uri}') LIMIT 1",
"geometry::BLOB": f"SELECT geometry::BLOB FROM read_parquet('{uri}') LIMIT 1",
"ST_SetCRS(geometry, 'EPSG:4326')": f"SELECT ST_SetCRS(geometry, 'EPSG:4326') FROM read_parquet('{uri}') LIMIT 1",
"ST_GeomFromWKB(ST_AsWKB(geometry))": f"SELECT ST_GeomFromWKB(ST_AsWKB(geometry)) FROM read_parquet('{uri}') LIMIT 1",
}
for i, (name, query) in enumerate(workarounds.items(), start=5):
print(f"\n--- {i}. Workaround: {name} ---")
try:
con.execute(query).fetchone()
print(" OK")
except Exception as e:
print(f" FAILED: {e}")
con.close()
```
## Output
```
duckdb version: 1.5.0
httpfs: 74f9540
spatial: 8734819
--- 1. DESCRIBE geometry column ---
type: GEOMETRY('OGC:CRS84')
--- 2. SELECT bbox (no geometry column) ---
OK
--- 3. SELECT geometry LIMIT 1 ---
FAILED: Not implemented Error: Unsupported type: "GEOMETRY('OGC:CRS84')"
--- 4. SELECT geometry with bbox WHERE ---
FAILED: Not implemented Error: Unsupported type: "GEOMETRY('OGC:CRS84')"
--- 5. Workaround: geometry::GEOMETRY ---
FAILED: Not implemented Error: Unsupported type: "GEOMETRY"
--- 6. Workaround: geometry::BLOB ---
FAILED: Conversion Error: Unimplemented type for cast (GEOMETRY('OGC:CRS84') -> BLOB) when casting from source column geometry
--- 7. Workaround: ST_SetCRS(geometry, 'EPSG:4326') ---
FAILED: Not implemented Error: Unsupported type: "GEOMETRY('EPSG:4326')"
--- 8. Workaround: ST_GeomFromWKB(ST_AsWKB(geometry)) ---
FAILED: Not implemented Error: Unsupported type: "GEOMETRY"
```
## Expected behavior
All geometry read operations (tests 3-8) should succeed. The CRS-annotated `GEOMETRY('OGC:CRS84')` type should be fully usable — readable, castable, and compatible with spatial functions.
## Notes
This is a regression — the same OvertureMaps data was previously readable with DuckDB + spatial. The CRS-aware geometry type appears to be recognised at the metadata/binder level but not implemented in the execution engine.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.