Skip to content

Commit

Permalink
Update usage of cudf.core.column.arange to cudf.core.column.as_column (
Browse files Browse the repository at this point in the history
…#1323)

This PR fixes failures which were caused becuase cuspatial uses an internal method of cudf that was removed in rapidsai/cudf#14689. The errors can be fixed by replacing those usages in the same fashion as was done internally in that cudf PR.

cc @vyasr

Authors:
  - Ajay Thorve (https://github.com/AjayThorve)

Approvers:
  - Michael Wang (https://github.com/isVoid)

URL: #1323
  • Loading branch information
AjayThorve authored Jan 13, 2024
1 parent 36549cd commit 9b2b723
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions python/cuspatial/cuspatial/core/_column/geocolumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pyarrow as pa

import cudf
from cudf.core.column import ColumnBase, arange, as_column, build_list_column
from cudf.core.column import ColumnBase, as_column, build_list_column

from cuspatial.core._column.geometa import Feature_Enum, GeoMeta
from cuspatial.utils.column_utils import empty_geometry_column
Expand Down Expand Up @@ -364,5 +364,5 @@ def _xy_as_variable_sized_list(xy: ColumnBase):
raise ValueError("xy must have an even number of elements")

num_points = len(xy) // 2
indices = arange(0, num_points * 2 + 1, 2, dtype="int32")
indices = as_column(range(0, num_points * 2 + 1, 2), dtype="int32")
return build_list_column(indices=indices, elements=xy, size=num_points)
6 changes: 3 additions & 3 deletions python/cuspatial/cuspatial/core/binops/distance_dispatch.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cudf
from cudf.core.column import arange, full
from cudf.core.column import as_column, full

from cuspatial._lib.distance import (
pairwise_linestring_distance,
Expand Down Expand Up @@ -190,8 +190,8 @@ def __call__(self):
float("nan"),
dtype="float64",
)
scatter_map = arange(
len(self._res_index), dtype="int32"
scatter_map = as_column(
range(len(self._res_index)), dtype="int32"
).apply_boolean_mask(self._non_null_mask)

result[scatter_map] = dist
Expand Down
4 changes: 2 additions & 2 deletions python/cuspatial/cuspatial/core/binops/intersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import TYPE_CHECKING

import cudf
from cudf.core.column import arange, build_list_column
from cudf.core.column import as_column, build_list_column

from cuspatial._lib.intersection import (
pairwise_linestring_intersection as c_pairwise_linestring_intersection,
Expand Down Expand Up @@ -93,7 +93,7 @@ def pairwise_linestring_intersection(
]

linestring_column = build_list_column(
indices=arange(0, len(segments) + 1, dtype="int32"),
indices=as_column(range(0, len(segments) + 1), dtype="int32"),
elements=segments,
size=len(segments),
)
Expand Down

0 comments on commit 9b2b723

Please sign in to comment.