Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GeoDataFrame to Use the Structured GatherMap Class #1219

Merged
merged 6 commits into from
Jul 18, 2023

Conversation

isVoid
Copy link
Contributor

@isVoid isVoid commented Jul 17, 2023

Description

As title, addresses upstream cudf change rapidsai/cudf#13534.

Fixes #1222

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@isVoid isVoid requested a review from a team as a code owner July 17, 2023 09:00
@isVoid isVoid requested review from trxcllnt and harrism July 17, 2023 09:00
@github-actions github-actions bot added the Python Related to Python code label Jul 17, 2023
@wence-
Copy link
Contributor

wence- commented Jul 17, 2023

geoseries also needs:

diff --git a/python/cuspatial/cuspatial/core/geoseries.py b/python/cuspatial/cuspatial/core/geoseries.py
index 2a66ccec..37c75783 100644
--- a/python/cuspatial/cuspatial/core/geoseries.py
+++ b/python/cuspatial/cuspatial/core/geoseries.py
@@ -22,6 +22,7 @@ from shapely.geometry import (
 import cudf
 from cudf._typing import ColumnLike
 from cudf.core.column.column import as_column
+from cudf.core.copy_types import GatherMap
 
 import cuspatial.io.pygeoarrow as pygeoarrow
 from cuspatial.core._column.geocolumn import ColumnType, GeoColumn
@@ -922,10 +923,10 @@ class GeoSeries(cudf.Series):
             aligned_right,
         )
 
-    def _gather(
-        self, gather_map, keep_index=True, nullify=False, check_bounds=True
-    ):
-        return self.iloc[gather_map]
+    def _gather(self, gather_map: GatherMap, keep_index=True):
+        # TODO: This could use the information to avoid reprocessing
+        # in iloc
+        return self.iloc[gather_map.column]
 
     # def reset_index(self, drop=False, inplace=False, name=None):
     def reset_index(

Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theres a booleanmask type too!

Comment on lines 185 to 187
def _apply_boolean_mask(self, gather_map: GatherMap) -> T:
geo_columns, data_columns = self._split_out_geometry_columns()
data = data_columns._apply_boolean_mask(mask)
data = data_columns._apply_boolean_mask(gather_map)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not a GatherMap but a copy_types.BooleanMask.

Copy link
Contributor

@wence- wence- Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that cudf's _apply_boolean_mask now also accepts a keep_index keyword argument, so you probably want to handle that here (or at least accept it).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cuspatial should really just try to avoid depending on cudf internals...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that is difficult if you're subclassing though :(

@isVoid isVoid added bug Something isn't working non-breaking Non-breaking change labels Jul 17, 2023
@isVoid isVoid requested a review from wence- July 17, 2023 09:14
@isVoid
Copy link
Contributor Author

isVoid commented Jul 18, 2023

/merge

@rapids-bot rapids-bot bot merged commit 1e0e357 into rapidsai:branch-23.08 Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working non-breaking Non-breaking change Python Related to Python code
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Fix cuspatial _gather API calls to reflect upstream cudf changes
4 participants