Skip to content

Enable direct ingestion and production of Arrow scalars - #14121

Merged
rapids-bot[bot] merged 59 commits into
NVIDIA:branch-23.10from
vyasr:feat/libcudf_scalar_to_arrow
Sep 23, 2023
Merged

rapids-bot[bot] merged 59 commits into
NVIDIA:branch-23.10from
vyasr:feat/libcudf_scalar_to_arrow

Conversation

@vyasr

@vyasr vyasr commented Sep 18, 2023

Copy link
Copy Markdown
Contributor

Description

This PR adds overloads of from_arrow and to_arrow for scalars to enable interoperability on par with Arrow Arrays. The new public APIs accept streams, and for consistency streams have also been added to the corresponding column APIs, so this PR contributes to #925.

Checklist

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

Comment thread cpp/include/cudf/detail/interop.hpp Resolved
Comment thread cpp/include/cudf/detail/interop.hpp Resolved
Comment thread cpp/src/interop/from_arrow.cu Resolved
Comment thread cpp/src/interop/to_arrow.cu Resolved
Comment thread cpp/src/interop/to_arrow.cu Resolved
Comment thread cpp/tests/interop/from_arrow_test.cpp Resolved
@vyasr
vyasr requested a review from bdice September 19, 2023 00:32
Comment thread cpp/include/cudf/interop.hpp Resolved
Comment thread cpp/tests/streams/interop_test.cpp Resolved
Comment thread cpp/src/interop/from_arrow.cu Resolved
Comment thread cpp/src/interop/from_arrow.cu Resolved
Comment thread cpp/src/interop/to_arrow.cu Resolved
rapids-bot Bot pushed a commit that referenced this pull request Sep 22, 2023
Fixes a couple places where `cudf::copy_bitmask` was called instead of `cudf::detail::copy_bitmask` to pass the available stream (and mr) parameters.

Found while reviewing #14121
Reference: #14121 (comment)

Authors:
  - David Wendt (https://github.com/davidwendt)

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

URL: #14158
Comment thread cpp/include/cudf/interop.hpp Resolved
@vyasr

vyasr commented Sep 22, 2023

Copy link
Copy Markdown
Contributor Author

/merge

@rapids-bot
rapids-bot Bot merged commit 71f30be into NVIDIA:branch-23.10 Sep 23, 2023
@vyasr
vyasr deleted the feat/libcudf_scalar_to_arrow branch September 23, 2023 01:15
rapids-bot Bot pushed a commit that referenced this pull request Sep 25, 2023
This PR replaces the various Cython converters for different libcudf scalar types by using the new libcudf `[to|from]_arrow` overloads for scalars introduced in #14121. This change dramatically simplifies the Cython code and paves the way for implementation of a pylibcudf.Scalar object.

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - https://github.com/brandon-b-miller

URL: #14124
@vyasr vyasr mentioned this pull request Oct 4, 2023
3 tasks
rapids-bot Bot pushed a commit that referenced this pull request Mar 8, 2024
It looks like soon after I started investigating scalar conversions for #14121 (but well before I made the PR) a major underlying hole was plugged in pyarrow via apache/arrow#36162. Most of #14121 was created to give us a way to handle scalars from pyarrow generically in libcudf. Now that pyarrow scalars can be easily tossed into arrays, we no longer really need separate scalar functions in libcudf; we can simply create an array from the scalar, put it into a table, and then call the table function.

Additionally, arrow also has a function for creating an array from a scalar. This function is not new but [was previously undocumented](apache/arrow#40373). The builder code added to libcudf in #14121 can be removed and replaced with that factory. The scalar conversion is as simple as calling that arrow function and then using our preexisting `from_arrow` function on the resulting array.

For now this PR is just a simplification of internals. Future PRs will remove the scalar API once we have a more standard path for the conversion of arrays via the C Data Interface.

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Yunsong Wang (https://github.com/PointKernel)
  - David Wendt (https://github.com/davidwendt)
  - Bradley Dice (https://github.com/bdice)

URL: #15213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 - Ready for Review Ready for review by team CMake CMake build issue feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants