2010YOUY01 opened a new pull request, #733:
URL: https://github.com/apache/sedona-db/pull/733
# Motivation
Heuristics-based join reordering can fail. Providing an option to disable it
allows manual control over spatial join order—the execution order will match
the query order.
This configuration only affects spatial joins, not regular joins, for
greater flexibility.
# Demo
In sedona-cli
```sh
> explain select t1.name from
'/Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_cities_geo.parquet'
as t1
join
'/Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_countries_geo.parquet'
as t2
on st_intersects(t1.geometry, t2.geometry);
┌───────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ plan_type ┆
plan
│
│ utf8 ┆
utf8
│
╞═══════════════╪═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
│ logical_plan ┆ Projection: t1.name
│
│ ┆ SpatialJoin: join_type=Inner,
filter=st_intersects(t1.geometry, t2.geometry)
│
│ ┆ SubqueryAlias: t1
│
│ ┆ TableScan:
/Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_cities_geo.parquet
projection=[name, geometry] │
│ ┆ SubqueryAlias: t2
│
│ ┆ TableScan:
/Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_countries_geo.parquet
projection=[geometry] │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ physical_plan ┆ SpatialJoinExec: join_type=Inner,
on=ST_intersects(geometry@0, geometry@1), projection=[name@1]
│
│ ┆ DataSourceExec: file_groups={1 group:
[[Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_countries_geo.parquet]]},
projection=[geometry], fil │
│ ┆ e_type=parquet
│
│ ┆ ProbeShuffleExec: partitioning=RoundRobinBatch(1)
│
│ ┆ DataSourceExec: file_groups={1 group:
[[Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_cities_geo.parquet]]},
projection=[name, geometry] │
│ ┆ , file_type=parquet
│
│ ┆
│
└───────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
2 row(s)/2 column(s) fetched.
Elapsed 0.005 seconds.
> SET sedona.spatial_join.spatial_join_reordering = false;
0 row(s)/0 column(s) fetched.
Elapsed 0.003 seconds.
> explain select t1.name from
'/Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_cities_geo.parquet'
as t1
join
'/Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_countries_geo.parquet'
as t2
on st_intersects(t1.geometry, t2.geometry);
┌───────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ plan_type ┆
plan
│
│ utf8 ┆
utf8
│
╞═══════════════╪═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
│ logical_plan ┆ Projection: t1.name
│
│ ┆ SpatialJoin: join_type=Inner,
filter=st_intersects(t1.geometry, t2.geometry)
│
│ ┆ SubqueryAlias: t1
│
│ ┆ TableScan:
/Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_cities_geo.parquet
projection=[name, geometry] │
│ ┆ SubqueryAlias: t2
│
│ ┆ TableScan:
/Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_countries_geo.parquet
projection=[geometry] │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ physical_plan ┆ SpatialJoinExec: join_type=Inner,
on=ST_intersects(geometry@1, geometry@0), projection=[name@0]
│
│ ┆ DataSourceExec: file_groups={1 group:
[[Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_cities_geo.parquet]]},
projection=[name, geometry], │
│ ┆ file_type=parquet
│
│ ┆ ProbeShuffleExec: partitioning=RoundRobinBatch(1)
│
│ ┆ DataSourceExec: file_groups={1 group:
[[Users/yongting/Code/sedona-db/submodules/geoarrow-data/natural-earth/files/natural-earth_countries_geo.parquet]]},
projection=[geometry], f │
│ ┆ ile_type=parquet
│
│ ┆
│
└───────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
2 row(s)/2 column(s) fetched.
Elapsed 0.005 seconds.
```
--
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]