feat: Explain plans render hard-to-read binary instead of geometry WKT
- Dominant language
- Rust
- Stars
- 503
- Forks
- 61
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 90
Description
It would be nice if `POINT (1 1)` was rendered instead of `Binary("1,1,0,0,0,0,0,0,0,0,0,240,63,0,0,0,0,0,0,240,63") FieldMetadata { inner: {"ARROW:extension:metadata": "{\"crs\":\"EPSG:4326\"}", "ARROW:extension:name": "geoarrow.wkb"} },`
```sql
> EXPLAIN SELECT * FROM 'https://github.com/geoarrow/geoarrow-data/releases/download/v0.2.0/microsoft-buildings_point_geo.parquet' WHERE ST_Contains(ST_SetSRID(ST_GeomFromText('point (1 1)'), 4326), geometry);
┌───────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ plan_type ┆ plan │
│ utf8 ┆ utf8 │
╞═══════════════╪═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
│ logical_plan ┆ Filter: st_contains(Binary("1,1,0,0,0,0,0,0,0,0,0,240,63,0,0,0,0,0,0,240,63") FieldMetadata { inner: {"ARROW:extension:metadata": "{\"crs\":\"EPSG:4326\"}", "ARROW:ext │
│ ┆ ension:name": "geoarrow.wkb"} }, https://github.com/geoarrow/geoarrow-data/releases/download/v0.2.0/microsoft-buildings_point_geo.parquet.geometry) │
│ ┆ TableScan: https://github.com/geoarrow/geoarrow-data/releases/download/v0.2.0/microsoft-buildings_point_geo.parquet projection=[geometry], partial_filters=[st_contai │
│ ┆ ns(Binary("1,1,0,0,0,0,0,0,0,0,0,240,63,0,0,0,0,0,0,240,63") FieldMetadata { inner: {"ARROW:extension:metadata": "{\"crs\":\"EPSG:4326\"}", "ARROW:extension:name": "ge │
│ ┆ oarrow.wkb"} }, https://github.com/geoarrow/geoarrow-data/releases/download/v0.2.0/microsoft-buildings_point_geo.parquet.geometry)] │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ physical_plan ┆ CoalesceBatchesExec: target_batch_size=8192 │
│ ┆ FilterExec: st_contains(01010000000000000000..., geometry@0) │
│ ┆ DataSourceExec: file_groups={10 groups: [[geoarrow/geoarrow-data/releases/download/v0.2.0/microsoft-buildings_point_geo.parquet:0..160323641], [geoarrow/geoarrow-d │
│ ┆ ata/releases/download/v0.2.0/microsoft-buildings_point_geo.parquet:160323641..320647282], [geoarrow/geoarrow-data/releases/download/v0.2.0/microsoft-buildings_point_ge │
│ ┆ o.parquet:320647282..480970923], [geoarrow/geoarrow-data/releases/download/v0.2.0/microsoft-buildings_point_geo.parquet:480970923..641294564], [geoarrow/geoarrow-data/ │
│ ┆ releases/download/v0.2.0/microsoft-buildings_point_geo.parquet:641294564..801618205], ...]}, projection=[geometry], file_type=parquet │
│ ┆ │
└───────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
2 row(s)/2 column(s) fetched.
Elapsed 1.664 seconds.
```
Using `EXPLAIN VERBOSE` (instead of just `EXPLAIN`), I can see that the initial logical plan represents it as `Utf8("point (1 1)")), Int64(4326))`, which is great! But eventually, Datafusion's `simplify_expressions` logical plan optimization is the first rule to convert that representation to this unreadable binary representation.
Contributor guide
Research direction
Start by tracing the EXPLAIN and EXPLAIN VERBOSE plan representations through DataFusion's simplify_expressions logical-plan optimization, which the issue identifies as the first conversion to binary. Compare the readable WKT form with the current binary output and verify that geometry literals remain readable in the rendered plan without losing the existing optimization behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100