Skip to content

Commit 6f6138b

Browse files
authored
GH-47375: [C++][Compute] Move scatter function into compute core (#47378)
### Rationale for this change In order to support special form (#47374), the kernels have to respect the selection vector. Currently none of the kernels does. And it's almost impossible for us to make all existing kernels to respect the selection vector at once (and we probably never will). Thus we need an incremental way to add selection-vector-aware kernels on demand, meanwhile accommodate legacy (selection-vector-non-aware) kernels to be executed "selection-vector-aware"-ly in a general manner - the idea is to first "gather" selected rows from the batch into a new batch, evaluate the expression on the new batch, then "scatter" the result rows into the positions where they belong in the original batch. This makes the `take` and `scatter` functions dependencies of the exec facilities, which is in compute core (libarrow). And `take` is already in compute core. Now we need to move `scatter`. I'm implementing the selective execution of kernels in #47377, including invoking `take` and `scatter` as explained above. And I have to write tests of that in `exec_test.cc` which is deliberately declared to be NOT depending on libarrow_compute. ### What changes are included in this PR? Move scatter compute function into compute core. ### Are these changes tested? Yes. Manually tested. ### Are there any user-facing changes? None. * GitHub Issue: #47375 Authored-by: Rossi Sun <[email protected]> Signed-off-by: Rossi Sun <[email protected]>
1 parent 7189472 commit 6f6138b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

cpp/src/arrow/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,8 @@ set(ARROW_COMPUTE_SRCS
739739
compute/kernels/vector_selection.cc
740740
compute/kernels/vector_selection_filter_internal.cc
741741
compute/kernels/vector_selection_internal.cc
742-
compute/kernels/vector_selection_take_internal.cc)
742+
compute/kernels/vector_selection_take_internal.cc
743+
compute/kernels/vector_swizzle.cc)
743744

744745
if(ARROW_COMPUTE)
745746
# If libarrow_compute.a is only built, "pkg-config --cflags --libs
@@ -789,7 +790,6 @@ if(ARROW_COMPUTE)
789790
compute/kernels/vector_select_k.cc
790791
compute/kernels/vector_sort.cc
791792
compute/kernels/vector_statistics.cc
792-
compute/kernels/vector_swizzle.cc
793793
compute/key_hash_internal.cc
794794
compute/key_map_internal.cc
795795
compute/light_array_internal.cc

cpp/src/arrow/compute/initialize.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ Status RegisterComputeKernels() {
5454
internal::RegisterVectorRunEndDecode(registry);
5555
internal::RegisterVectorPairwise(registry);
5656
internal::RegisterVectorStatistics(registry);
57-
internal::RegisterVectorSwizzle(registry);
5857

5958
// Aggregate functions
6059
internal::RegisterHashAggregateBasic(registry);

cpp/src/arrow/compute/registry.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ static std::unique_ptr<FunctionRegistry> CreateBuiltInRegistry() {
287287
RegisterDictionaryDecode(registry.get());
288288
RegisterVectorHash(registry.get());
289289
RegisterVectorSelection(registry.get());
290+
RegisterVectorSwizzle(registry.get());
290291

291292
RegisterScalarOptions(registry.get());
292293
RegisterVectorOptions(registry.get());

0 commit comments

Comments
 (0)