Skip to content

fix: check_geometry_validity failed against real output - #751

Merged
brawer merged 1 commit into
mainfrom
fix-geometry-validity-native-type
Aug 22, 2026
Merged

fix: check_geometry_validity failed against real output#751
brawer merged 1 commit into
mainfrom
fix-geometry-validity-native-type

Conversation

@brawer

@brawer brawer commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

What

Caught live during the first fully successful smoke-test run of #722's whole chain: ST_GeomFromWKB(osm_geometry) crashed with

_duckdb.BinderException: Binder Error: No function matches the given name and argument types 'st_geomfromwkb(GEOMETRY)'.

docs/outputs/CONFLATED_PARQUET.md documents osm_geometry as plain WKB bytes, but the real column carries the native Parquet GEOGRAPHY logical type -- DuckDB's spatial extension auto-decodes that straight to a native GEOMETRY value on read, once loaded. ST_GeomFromWKB expects BLOB input, so calling it on an already-GEOMETRY value was never going to work. Fix: call ST_IsValid directly, no conversion needed.

Why this shipped undetected through #743/#744

The test fixtures constructed atp_geometry/osm_geometry via ST_AsWKB(...)::BLOB -- a column type real osm-diffs output never actually has. Updated fixtures to use native GEOMETRY (ST_Point(...) directly), matching reality, which is exactly what would have caught this before it shipped.

Testing

uv run pytest (78/78) and uvx ruff check clean. Verified against the real completed run this was found on: validate now passes cleanly end-to-end -- 1,731,159 rows, every hard check green. First fully successful run of the whole #722 chain (built from main, containerized, --regional-extract europe/switzerland, real cgroup limits, real S3 upload).

🤖 Generated with Claude Code

…t BLOB)

Caught live during the first fully successful smoke-test run of #722's
whole chain: `ST_GeomFromWKB(osm_geometry)` crashed with
`_duckdb.BinderException: No function matches ... 'st_geomfromwkb(GEOMETRY)'`.

docs/outputs/CONFLATED_PARQUET.md documents osm_geometry as plain WKB
bytes, but the real column carries the native Parquet GEOGRAPHY
logical type (see pipeline::conflate::writer's own doc comment) --
DuckDB's spatial extension auto-decodes that straight to a native
GEOMETRY value on read, once loaded. ST_GeomFromWKB expects BLOB input,
so calling it on an already-GEOMETRY value is a type error, not
something that was ever going to work. Fix: call ST_IsValid directly,
no conversion needed.

Test fixtures updated to match: atp_geometry/osm_geometry now
constructed as native GEOMETRY (ST_Point(...) directly), not cast to
::BLOB via ST_AsWKB -- the cast produced a column type real osm-diffs
output never actually has, which is exactly why this bug shipped
undetected through #743/#744's full test suites.

Verified against the real completed run: validate now passes cleanly
end-to-end (1,731,159 rows, all hard checks green) -- the first
completely successful run of the whole #722 chain.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the bug Something isn't working label Aug 22, 2026
@brawer
brawer added this pull request to the merge queue Aug 22, 2026
Merged via the queue into main with commit f8522b3 Aug 22, 2026
7 checks passed
@brawer
brawer deleted the fix-geometry-validity-native-type branch August 22, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant