ibis
ibis copied to clipboard
fix(duckdb): use simple GEOMETRY type for all geospatial data (#10324)
Ensure compatibility with DuckDB's implementation of geospatial types.
I would love to add tests. Which is the appropriate test file?
- [ ] added tests
Description of changes
In https://github.com/ibis-project/ibis/issues/10324 the temporary table generated the incorrect SQL definition of GEOMETRY(POINT) instead of the simple GEOMETRY. This ensures that the simple GEOMETRY will be used for all geospatial types.
Issues closed
- Resolves #10324
Thanks @anjakefala !
Since this change is specific to the DuckDB backend, tests should go in ibis/backends/DuckDB/tests/
For this particular fix, either test_datatypes.py or test_geospatial.py work -- whichever feels like a better fit to you!
@anjakefala Ping on this! Still interested in adding a test?
@cpcloud Yes, sorry! I'm travelling soon, but was planning to add tests today!
Hey @gforsyth and @cpcloud!
I added a simple test. But unlike with the issue, this test passes on main. So there is something about the fetched example that lead to the issue. I'm investigating that currently to see if I can reproduce it in an example. I pushed the small test I had so far.
Would it make sense for me to add tests checking that all the geometry types were being compiled as GEOMETRY? Do you write tests at the level of compiled sql?
It seems that the example zone already contained a geom column. Reproducing the scenario still unfortunately passed on main:
565
566 def test_cache_geometry(con):
567 # ibis issue #10324
568 data = ibis.memtable({"x": [1, 3], "y": [2, 4]})
569 data = data.mutate(geom=data.x.point(data.y))
570 data = data.mutate(geom=data.x.point(data.y)).cache()
571 result = data.execute()
572 assert result['geom'].iloc[0] == shapely.Point(1, 2)
Your test fails for me on main with the same error reported by the user. Are you sure you were running your test against main?
@cpcloud HUH. Okay, then. Carry on.
Thanks!