duckdb / duckdb/duckdb-spatial

st_read with only non-geometry columns still reads geometry

Open
#836 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
708
Forks
96
Avg merge
1d 21h
Merged PRs (30d)
5

Description

A bit of an edge case I ran into. We received data as geopackage, with Curve geometries. This can not be read by DuckDB spatial. I used ogr2ogr to converth the GPKG file to a GeoParquet file, which works fine (although curve support would be awesome). Then I wan to do a simple count of the numbers of records, to be sure the conversion worked:

`SELECT COUNT(fid) FROM st_read('my-geopackage.gpkg')`

The fid column is an integer column. In this scenario, there is no need to read the geometry of the geopackage. Yet it throws the following error:
`Exception has occurred: InvalidInputException Invalid Input Error: Unsupported geometry type in WKB`. It would be nice if the query could still work and I think it would enhance performance if st_read only reads geometry when it is absolutely necessary.

I'm running this on 1.5.4 of DuckDB by the way.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the `SELECT COUNT(fid) FROM st_read('my-geopackage.gpkg')` query with a GeoPackage containing Curve geometries. Trace the `st_read` entry point and its column-reading path to determine why geometry is decoded when only `fid` is selected. Done means the count query succeeds without requiring unsupported geometry handling, while geometry-reading queries retain their existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.