Copilot commented on code in PR #2726:
URL: https://github.com/apache/sedona/pull/2726#discussion_r2921593438
##########
python/sedona/spark/geopandas/geodataframe.py:
##########
@@ -1237,10 +1237,7 @@ def to_feather(
@property
def type(self):
Review Comment:
`GeoDataFrame.type` overrides `GeoFrame.type` but only returns
`self.geom_type` and has no docstring. This is redundant and hides the base
docstring from users. Consider removing the override to inherit the documented
base behavior, or add a docstring/return annotation here if an override is
required.
```suggestion
def type(self) -> Any:
"""
Geometry type(s) of each geometry in the active geometry column.
This is an alias for :attr:`geom_type`.
Returns
-------
Any
The same value as ``self.geom_type``.
"""
```
##########
python/sedona/spark/geopandas/geoseries.py:
##########
@@ -1144,8 +1157,14 @@ def line_merge(self, directed=False):
@property
def unary_union(self):
- # Implementation of the abstract method.
- raise NotImplementedError("This method is not implemented yet.")
+ import warnings
+
+ warnings.warn(
+ "The 'unary_union' attribute is deprecated, use the 'union_all()'
method instead.",
+ FutureWarning,
+ stacklevel=2,
+ )
+ return self.union_all()
Review Comment:
`GeoSeries.unary_union` now duplicates the deprecation warning logic already
present in `GeoFrame.unary_union`, but does not include a docstring. Keeping
only one implementation (preferably the documented base property) would reduce
duplication and ensure `help(GeoSeries.unary_union)` shows the intended docs;
otherwise, add a docstring here matching the base API docs.
##########
python/sedona/spark/geopandas/geoseries.py:
##########
@@ -730,10 +730,7 @@ def geom_type(self) -> pspd.Series:
@property
def type(self):
Review Comment:
`GeoSeries.type` overrides the new `GeoFrame.type` implementation but only
returns `self.geom_type` and provides no docstring/type hints. This override is
redundant and also hides the base docstring from users (e.g.,
`help(GeoSeries.type)`). Consider removing this override to inherit the
documented base behavior, or add an equivalent docstring/return annotation here
if an override is required.
```suggestion
def type(self) -> pspd.Series:
"""Return the geometry type of each geometry.
This is an alias for :attr:`geom_type`, provided for
compatibility with the GeoPandas ``GeoSeries.type`` API.
Returns
-------
pyspark.pandas.Series
Series of geometry type names (e.g. ``'Point'``, ``'Polygon'``).
"""
```
--
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]