Skip to content

feat: Explain plans render hard-to-read binary instead of geometry WKT #75

@petern48

Description

@petern48

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"} },

> 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions