Skip to content

Commit

Permalink
Add data=None to ListColumn constructor (#1442)
Browse files Browse the repository at this point in the history
Post rapidsai/cudf#16465, the `data` argument to `ListColumn` is a required argument (as `None`)

Authors:
  - Matthew Roeschke (https://github.com/mroeschke)

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #1442
  • Loading branch information
mroeschke authored Aug 21, 2024
1 parent f678ad5 commit 5dd14ef
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/cuspatial/cuspatial/core/_column/geocolumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def _from_multipoints_xy(

multi_elements = _xy_as_variable_sized_list(multipoints_xy)
multipoint_col = ListColumn(
data=None,
dtype=cudf.ListDtype(multi_elements.dtype),
size=len(geometry_offsets) - 1,
children=(geometry_offsets, multi_elements),
Expand Down Expand Up @@ -235,11 +236,13 @@ def _from_linestrings_xy(

parts_elements = _xy_as_variable_sized_list(linestrings_xy)
parts_col = ListColumn(
data=None,
dtype=cudf.ListDtype(parts_elements.dtype),
size=len(part_offsets) - 1,
children=(part_offsets, parts_elements),
)
linestrings_col = ListColumn(
data=None,
dtype=cudf.ListDtype(parts_col.dtype),
size=len(geometry_offsets) - 1,
children=(geometry_offsets, parts_col),
Expand Down Expand Up @@ -296,16 +299,19 @@ def _from_polygons_xy(

ring_elements = _xy_as_variable_sized_list(polygons_xy)
rings_col = ListColumn(
data=None,
dtype=cudf.ListDtype(ring_elements.dtype),
size=len(ring_offsets) - 1,
children=(ring_offsets, ring_elements),
)
parts_col = ListColumn(
data=None,
dtype=cudf.ListDtype(rings_col.dtype),
size=len(part_offsets) - 1,
children=(part_offsets, rings_col),
)
polygons_col = ListColumn(
data=None,
dtype=cudf.ListDtype(parts_col.dtype),
size=len(geometry_offsets) - 1,
children=(geometry_offsets, parts_col),
Expand Down Expand Up @@ -369,5 +375,8 @@ def _xy_as_variable_sized_list(xy: ColumnBase):
num_points = len(xy) // 2
indices = as_column(range(0, num_points * 2 + 1, 2), dtype="int32")
return ListColumn(
dtype=cudf.ListDtype(xy.dtype), size=num_points, children=(indices, xy)
data=None,
dtype=cudf.ListDtype(xy.dtype),
size=num_points,
children=(indices, xy),
)
2 changes: 2 additions & 0 deletions python/cuspatial/cuspatial/core/binops/intersection.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def pairwise_linestring_intersection(
# Organize the look back ids into list column
(lhs_linestring_id, lhs_segment_id, rhs_linestring_id, rhs_segment_id,) = [
ListColumn(
data=None,
dtype=cudf.ListDtype(id_.dtype),
size=len(geometry_collection_offset) - 1,
children=(geometry_collection_offset, id_),
Expand All @@ -94,6 +95,7 @@ def pairwise_linestring_intersection(
]

linestring_column = ListColumn(
data=None,
dtype=cudf.ListDtype(segments.dtype),
size=segments.size,
children=(
Expand Down

0 comments on commit 5dd14ef

Please sign in to comment.