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

GH-45269: [C++][Compute] Add "pivot_wider" and "hash_pivot_wider" functions #45562

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pitrou
Copy link
Member

@pitrou pitrou commented Feb 18, 2025

Rationale for this change

Add "pivot wider" functionality such as in Pandas, through two dedicated functions:

  1. a "pivot_wider" scalar aggregate function returning a Struct scalar
  2. a "hash_pivot_wider" grouped aggregate function returning a Struct array

Both functions take two arguments (the column of pivot keys and the column of pivot values) and require passing a PivotWiderOptions structure with the expected pivot keys, so as to determine the output Struct type.

Are these changes tested?

Yes, by dedicated unit tests.

Are there any user-facing changes?

No, just new APIs.

@pitrou pitrou marked this pull request as ready for review February 18, 2025 12:52
@pitrou pitrou requested a review from westonpace as a code owner February 18, 2025 12:52
@pitrou pitrou requested review from zanmato1984 and removed request for westonpace February 18, 2025 12:52
@pitrou
Copy link
Member Author

pitrou commented Feb 18, 2025

@github-actions crossbow submit -g cpp

Copy link

Revision: 53cff55

Submitted crossbow builds: ursacomputing/crossbow @ actions-d681b13450

Task Status
example-cpp-minimal-build-static GitHub Actions
example-cpp-minimal-build-static-system-dependency GitHub Actions
example-cpp-tutorial GitHub Actions
test-alpine-linux-cpp GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-cuda-cpp-ubuntu-22.04-cuda-11.7.1 GitHub Actions
test-debian-12-cpp-amd64 GitHub Actions
test-debian-12-cpp-i386 GitHub Actions
test-fedora-39-cpp GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-20 GitHub Actions
test-ubuntu-22.04-cpp-bundled GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-bundled-offline GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

Comment on lines +297 to +303
// Move away the states and recreate them eagerly, to make sure that any error
// below does not leave us with empty states.
auto states = std::move(states_);
states_.resize(kernels_.size());
if (!is_last) {
RETURN_NOT_OK(ResetKernelStates());
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Without this change, any error in MergeAll below could lead to a crash.

@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review labels Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant