rtpsw commented on code in PR #14682:
URL: https://github.com/apache/arrow/pull/14682#discussion_r1049689347
##########
python/pyarrow/src/arrow/python/udf.cc:
##########
@@ -17,35 +17,83 @@
#include "arrow/python/udf.h"
#include "arrow/compute/function.h"
+#include "arrow/compute/kernel.h"
#include "arrow/python/common.h"
+#include "arrow/util/checked_cast.h"
namespace arrow {
-
-using compute::ExecResult;
-using compute::ExecSpan;
-
namespace py {
namespace {
-struct PythonUdf : public compute::KernelState {
- ScalarUdfWrapperCallback cb;
+struct PythonScalarUdfKernelState : public compute::KernelState {
+ explicit PythonScalarUdfKernelState(std::shared_ptr<OwnedRefNoGIL> function)
+ : function(function) {}
+
std::shared_ptr<OwnedRefNoGIL> function;
Review Comment:
No, we can't do this change. The kernel init's `function` is different than
the kernel state's. The former `function` refers to a UDT-maker
([example](https://github.com/apache/arrow/pull/14682/files#diff-0f8e15b029a7828bd24b7063ac03bc1e33537546b7eb7475c17d062d4d7bf1bfR522),
which returns a UDT
([example](https://github.com/apache/arrow/pull/14682/files#diff-0f8e15b029a7828bd24b7063ac03bc1e33537546b7eb7475c17d062d4d7bf1bfR523)),
which is referred to by the latter. Thus, each UDT is a distinct Python object
that is held by a distinct kernel state.
--
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]