This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sedona-spatialbench.git
The following commit(s) were added to refs/heads/main by this push:
new b79630f spatial polars Q11 query fix (#75)
b79630f is described below
commit b79630fd25b4f5bceb7b61e0a25b718de110f57a
Author: ATL2001 <[email protected]>
AuthorDate: Mon Jan 19 13:46:56 2026 -0500
spatial polars Q11 query fix (#75)
---
spatialbench-queries/spatial_polars.py | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/spatialbench-queries/spatial_polars.py
b/spatialbench-queries/spatial_polars.py
index 79149df..bc91abd 100644
--- a/spatialbench-queries/spatial_polars.py
+++ b/spatialbench-queries/spatial_polars.py
@@ -523,23 +523,22 @@ def q11(data_paths: dict[str, str]) -> DataFrame:
)
return (
- trip_df.spatial.join(
- zone_df,
- left_on="t_pickuploc",
- right_on="z_boundary",
- predicate="intersects",
- )
- .spatial.join(
- zone_df,
- left_on="t_dropoffloc",
- right_on="z_boundary",
- predicate="intersects",
+ zone_df.spatial.join(
+ zone_df.spatial.join(
+ trip_df,
+ how="inner",
+ left_on="z_boundary",
+ right_on="t_pickuploc",
+ predicate="contains",
+ ),
+ how="inner",
+ left_on="z_boundary",
+ right_on="t_dropoffloc",
+ predicate="contains",
suffix="_dropoff",
- )
- .filter(
+ ).filter(
pl.col("z_zonekey") != pl.col("z_zonekey_dropoff"),
- )
- .select(
+ ).select(
pl.len().alias("cross_zone_trip_count"),
)
)