paleolimbot opened a new pull request, #384:
URL: https://github.com/apache/sedona-db/pull/384

   Closes #380. The issue was that we were passed a column index of `0` in some 
circumstances when the geometry column index was `2` (see the debug output on 
the issue for details).
   
   I think the fact that we are passed an incorrect `Column { ..., index: 0}` 
is a DataFusion bug (I am guessing there is an `unwrap_or(0)` in some 
`try_pushdown_filter()`); however, in the meantime using the column name seems 
to work.
   
   ```python
   # pip install "apache-sedona[db]"
   import sedona.db
   
   sd = sedona.db.connect()
   
   url = "https://flatgeobuf.septima.dk/population_areas.fgb";
   sd.read_pyogrio(url).to_view("population_areas")
   
   # Cancelled after 30s
   wkt = "POLYGON ((-73.978329 40.767412, -73.950005 40.767412, -73.950005 
40.795098, -73.978329 40.795098, -73.978329 40.767412))"
   sd.sql(f"""
   SELECT sum(population::INTEGER) FROM population_areas
   WHERE ST_Intersects(wkb_geometry, ST_SetSRID(ST_GeomFromWKT('{wkt}'), 4326))
   """).show()
   #> ┌──────────────────────────────────┐
   #> │ sum(population_areas.population) │
   #> │               int64              │
   #> ╞══════════════════════════════════╡
   #> │                           256251 │
   #> └──────────────────────────────────┘
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to