fix(go): geo type auto-detect should not require edges:spherical for GEOGRAPHY#167
fix(go): geo type auto-detect should not require edges:spherical for GEOGRAPHY#167jatorre wants to merge 1 commit into
Conversation
…GEOGRAPHY resolveGeoType's documented contract (and the original adbc-drivers#117 semantics) says 'missing CRS, EPSG:4326, or unparsable CRS stays GEOGRAPHY', but the code required edges == "spherical" as well. Most GeoArrow producers (DuckDB, GeoPandas) emit a crs with no edges field, so all WGS84 data silently demoted to GEOMETRY on ingest. Auto-detect now resolves: SRID 4326 or no CRS -> GEOGRAPHY; any other SRID -> GEOMETRY (SRID survives the round trip); edges:spherical with a non-4326 SRID remains an error. Explicit ingest_geo_type is unchanged. Claude-Session: https://claude.ai/code/session_01Y3xqZXWrx9qXdPNXBzNxa2
|
CC @paleolimbot but my understanding is that this was semantically required |
Yes, this is my fault 🙂 .
Both of these only support "geometry", so "geometry" is the type that should be automatically chosen (although it's fair that you'd want to override that choice if you want to insert into a Snowflake geography, which I believe is possible). Specifically, these tools treat edges as Cartesian planar edges regardless of CRS, so they map to the Snowflake version of that. The only tools I know about that support the union of Geography, Geometry, and GeoArrow are SedonaDB and PyArrow (after GeoArrow extension types are loaded via
Probably the fix here is to fix the comment, which is outdated. |
resolveGeoType's own doc comment says "missing CRS, EPSG:4326, or unparsable CRS stays GEOGRAPHY", anddocs/snowflake.md's option table described detection differently again — but the implementation requirededges == "spherical"in addition to SRID 4326 before choosing GEOGRAPHY.Most GeoArrow producers emit a
crsbut noedgesfield (DuckDB's spatial extension and GeoPandas among them), so in practice every WGS84 column ingested through auto-detect silently landed as GEOMETRY. We hit this in CARTO's integration suite when moving from the pre-merge #117 branch togo/v1.11.0: same import,GEOGRAPHYbecameGEOMETRY.This aligns the code with the documented contract:
edges:sphericalwith a non-4326 SRID → still an error (unchanged)adbc.snowflake.statement.ingest_geo_type→ unchanged, pins all columnsUpdated
TestResolveGeoTypeand the option docs to match. The two auto-detect validation txtcases are unaffected (the GEOGRAPHY one uses 4326+spherical, the GEOMETRY one uses EPSG:2029).https://claude.ai/code/session_01Y3xqZXWrx9qXdPNXBzNxa2