diff --git a/bigframes/core/compile/compiled.py b/bigframes/core/compile/compiled.py index d2fd7f3ea2..4443c495d7 100644 --- a/bigframes/core/compile/compiled.py +++ b/bigframes/core/compile/compiled.py @@ -665,9 +665,11 @@ def _join_condition( def _as_groupable(value: ibis_types.Value): - # Some types need to be converted to string to enable groupby - if value.type().is_float64() or value.type().is_geospatial(): + # Some types need to be converted to another type to enable groupby + if value.type().is_float64(): return value.cast(ibis_dtypes.str) + elif value.type().is_geospatial(): + return typing.cast(ibis_types.GeoSpatialColumn, value).as_binary() elif value.type().is_json(): return scalar_op_compiler.to_json_string(value) else: diff --git a/tests/system/small/geopandas/test_geoseries.py b/tests/system/small/geopandas/test_geoseries.py index fdd9826468..fb101dea89 100644 --- a/tests/system/small/geopandas/test_geoseries.py +++ b/tests/system/small/geopandas/test_geoseries.py @@ -289,3 +289,20 @@ def test_geo_difference_with_similar_geometry_objects(): assert expected.iloc[0].equals(bf_result.iloc[0]) assert expected.iloc[1].equals(bf_result.iloc[1]) assert expected.iloc[2].equals(bf_result.iloc[2]) + + +def test_geo_drop_duplicates(): + bf_series = bigframes.geopandas.GeoSeries( + [Point(1, 1), Point(2, 2), Point(3, 3), Point(2, 2)] + ) + + pd_series = geopandas.GeoSeries( + [Point(1, 1), Point(2, 2), Point(3, 3), Point(2, 2)] + ) + + bf_result = bf_series.drop_duplicates().to_pandas() + pd_result = pd_series.drop_duplicates() + + pd.testing.assert_series_equal( + geopandas.GeoSeries(bf_result), pd_result, check_index=False + )