You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/04/26 15:04:34 UTC

[GitHub] [arrow] bkietz commented on a change in pull request #10098: ARROW-11990: [C++][Compute] Handle errors consistently

bkietz commented on a change in pull request #10098:
URL: https://github.com/apache/arrow/pull/10098#discussion_r620374215



##########
File path: cpp/src/arrow/compute/kernels/scalar_string.cc
##########
@@ -1314,61 +1312,62 @@ struct ReplaceSubString {
   using OffsetBuilder = TypedBufferBuilder<offset_type>;
   using State = OptionsWrapper<ReplaceSubstringOptions>;
 
-  static void Exec(KernelContext* ctx, const ExecBatch& batch, Datum* out) {
+  static Status Exec(KernelContext* ctx, const ExecBatch& batch, Datum* out) {
     // TODO Cache replacer across invocations (for regex compilation)
-    Replacer replacer{ctx, State::Get(ctx)};
-    if (!ctx->HasError()) {
-      Replace(ctx, batch, &replacer, out);
-    }
+    Replacer replacer{State::Get(ctx)};
+    RETURN_NOT_OK(replacer.status_);

Review comment:
       Nit:
   ```suggestion
       ARROW_ASSIGN_OR_RAISE(auto replacer, Replacer::Make(State::Get(ctx)));
   ```

##########
File path: cpp/src/arrow/compute/kernels/codegen_internal.h
##########
@@ -751,8 +747,10 @@ struct ScalarUnaryNotNull {
 //
 // struct Op {
 //   template <typename OutValue, typename Arg0Value, typename Arg1Value>
-//   static OutValue Call(KernelContext* ctx, Arg0Value arg0, Arg1Value arg1) {
+//   static OutValue Call(KernelContext* ctx, Arg0Value arg0, Arg1Value arg1, Status* st)
+//   {
 //     // implementation
+//     // NOTE: "status" is only populated with errors, not Status::OK()

Review comment:
       ```suggestion
   //     // NOTE: "status" should only populated with errors, leave it unmodified to indicate Status::OK()
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org