duckdb / duckdb/duckdb-spatial

Inconsistent behavior of ST_READ in importing EMPTY geometry

Open
#273 1 comment 1 reaction 0 assignees View on GitHub
GDAL
Dominant language
C
Stars
708
Forks
96
Avg merge
1d 21h
Merged PRs (30d)
5

Description

Considering the following geojson file:
```
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": []
},
"properties": {
"id": 0
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": []
},
"properties": {
"id": 1
}
}
]
}
```
and SQL statement:
```sql
CREATE TABLE t0 AS SELECT * FROM ST_READ('/log/t0.geojson');
SELECT id, ST_AsText(geom) FROM t0;
-- ┌───────┬──────────────────┐
-- │ id │ st_astext(geom) │
-- │ int32 │ varchar │
-- ├───────┼──────────────────┤
-- │ 0 │ │
-- │ 1 │ LINESTRING EMPTY │
-- └───────┴──────────────────┘
```
The EMPTY POLYGON should be imported into t0 to avoid losing information during the importing process.

Besides, the EMPTY LINESTRING is imported successfully. The importing behaviors of POLYGON and LINESTRING should be consistent.

Version:
Spatial version:
FORCE INSTALL spatial FROM 'http://nightly-extensions.duckdb.org'; and LOAD spatial;

DuckDB version:
```
┌─────────────────┬────────────┐
│ library_version │ source_id │
│ varchar │ varchar │
├─────────────────┼────────────┤
│ v0.10.0 │ 20b1486d11 │
└─────────────────┴────────────┘
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the supplied GeoJSON and SQL with DuckDB v0.10.0 and the spatial extension, then compare ST_READ handling for the empty Polygon and LineString. The fix is done when the empty Polygon is imported into t0 and ST_AsText preserves it consistently with the empty LineString.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.