raulcd commented on PR #45618:
URL: https://github.com/apache/arrow/pull/45618#issuecomment-2769236806
> This all seems very complicated to me. You should only need something like:
I also thought that should work but, if I understand correctly, this diff
should do the trick:
```diff
diff --git a/cpp/src/arrow/compute/kernels/api.h
b/cpp/src/arrow/compute/kernels/api.h
index 3385d4cc80..8a22c6c3ca 100644
--- a/cpp/src/arrow/compute/kernels/api.h
+++ b/cpp/src/arrow/compute/kernels/api.h
@@ -25,5 +25,3 @@
/// @}
#include "arrow/compute/kernels/registry.h" // IWYU pragma: export
-
-static arrow::Status g_kernels_registered =
arrow::compute::RegisterComputeKernels();
diff --git a/cpp/src/arrow/compute/kernels/registry.cc
b/cpp/src/arrow/compute/kernels/registry.cc
index fe9c2df724..d9c899bec4 100644
--- a/cpp/src/arrow/compute/kernels/registry.cc
+++ b/cpp/src/arrow/compute/kernels/registry.cc
@@ -33,11 +33,11 @@
namespace arrow {
namespace compute {
-Status RegisterComputeKernels() {
+bool RegisterComputeKernels() {
auto registry = GetFunctionRegistry();
// TODO: Do we have a different way to avoid double registration?
if (registry->GetFunction("abs").ok()) {
- return Status::OK();
+ return true;
}
// Register additional kernels on libarrow_compute
// Scalar functions
@@ -78,7 +78,9 @@ Status RegisterComputeKernels() {
internal::RegisterScalarAggregateTDigest(registry);
internal::RegisterScalarAggregateVariance(registry);
- return Status::OK();
+ return true;
}
+
+bool g_kernels_registered = RegisterComputeKernels();
} // namespace compute
} // namespace arrow
diff --git a/cpp/src/arrow/compute/kernels/registry.h
b/cpp/src/arrow/compute/kernels/registry.h
index 02c002126a..075bd92002 100644
--- a/cpp/src/arrow/compute/kernels/registry.h
+++ b/cpp/src/arrow/compute/kernels/registry.h
@@ -19,10 +19,9 @@
#include "arrow/compute/registry.h"
#include "arrow/compute/visibility.h"
-#include "arrow/status.h"
namespace arrow::compute {
-ARROW_COMPUTE_EXPORT Status RegisterComputeKernels();
+ARROW_COMPUTE_EXPORT bool RegisterComputeKernels();
} // namespace arrow::compute
```
but on this case, the kernels are not registered when linking
`libarrow_compute` and tests just fail because the kernels are not registered,
example:
```
'_error_or_value26.status()' failed with Key error: No function registered
with name: round_temporal
/home/raulcd/code/arrow/cpp/src/arrow/compute/exec.cc:1367
ctx->func_registry()->GetFunction(func_name)
/home/raulcd/code/arrow/cpp/src/arrow/compute/kernels/test_util_internal.cc:87:
Failure
Failed
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]