Skip to content

Commit bdcb1e7

Browse files
feat: Support window partition by geo column (#1512)
1 parent 222af75 commit bdcb1e7

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

bigframes/core/compile/compiled.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,11 @@ def _join_condition(
665665

666666

667667
def _as_groupable(value: ibis_types.Value):
668-
# Some types need to be converted to string to enable groupby
669-
if value.type().is_float64() or value.type().is_geospatial():
668+
# Some types need to be converted to another type to enable groupby
669+
if value.type().is_float64():
670670
return value.cast(ibis_dtypes.str)
671+
elif value.type().is_geospatial():
672+
return typing.cast(ibis_types.GeoSpatialColumn, value).as_binary()
671673
elif value.type().is_json():
672674
return scalar_op_compiler.to_json_string(value)
673675
else:

tests/system/small/geopandas/test_geoseries.py

+17
Original file line numberDiff line numberDiff line change
@@ -289,3 +289,20 @@ def test_geo_difference_with_similar_geometry_objects():
289289
assert expected.iloc[0].equals(bf_result.iloc[0])
290290
assert expected.iloc[1].equals(bf_result.iloc[1])
291291
assert expected.iloc[2].equals(bf_result.iloc[2])
292+
293+
294+
def test_geo_drop_duplicates():
295+
bf_series = bigframes.geopandas.GeoSeries(
296+
[Point(1, 1), Point(2, 2), Point(3, 3), Point(2, 2)]
297+
)
298+
299+
pd_series = geopandas.GeoSeries(
300+
[Point(1, 1), Point(2, 2), Point(3, 3), Point(2, 2)]
301+
)
302+
303+
bf_result = bf_series.drop_duplicates().to_pandas()
304+
pd_result = pd_series.drop_duplicates()
305+
306+
pd.testing.assert_series_equal(
307+
geopandas.GeoSeries(bf_result), pd_result, check_index=False
308+
)

0 commit comments

Comments
 (0)