-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pylibcudf Table.num_rows for 0 columns case and add interop to do…
…cs (#16108) There was a bug where Table.num_rows raised when we had 0 columns instead of returning 0. I also added interop to the docs since that was missing. Authors: - Thomas Li (https://github.com/lithomas1) Approvers: - Matthew Roeschke (https://github.com/mroeschke) URL: #16108
- Loading branch information
Showing
4 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
======= | ||
interop | ||
======= | ||
|
||
.. automodule:: cudf._lib.pylibcudf.interop | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2024, NVIDIA CORPORATION. | ||
|
||
import pyarrow as pa | ||
import pytest | ||
|
||
import cudf._lib.pylibcudf as plc | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"arrow_tbl", | ||
[ | ||
pa.table([]), | ||
pa.table({"a": [1, 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}), | ||
pa.table({"a": [1, 2, 3]}), | ||
pa.table({"a": [1], "b": [2], "c": [3]}), | ||
], | ||
) | ||
def test_table_shape(arrow_tbl): | ||
plc_tbl = plc.interop.from_arrow(arrow_tbl) | ||
|
||
plc_tbl_shape = (plc_tbl.num_rows(), plc_tbl.num_columns()) | ||
assert plc_tbl_shape == arrow_tbl.shape |