You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "icexelloss (via GitHub)" <gi...@apache.org> on 2023/02/27 21:12:34 UTC

[GitHub] [arrow] icexelloss commented on a diff in pull request #34373: GH-34333: [Python] Test run_query with a registered scalar UDF

icexelloss commented on code in PR #34373:
URL: https://github.com/apache/arrow/pull/34373#discussion_r1119317187


##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -547,8 +547,9 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
         std::shared_ptr<Field> project_field;
         ARROW_ASSIGN_OR_RAISE(compute::Expression des_expr,
                               FromProto(expr, ext_set, conversion_options));
-        auto bound_expr = des_expr.Bind(*input.output_schema);
-        if (auto* expr_call = bound_expr->call()) {
+        ARROW_ASSIGN_OR_RAISE(

Review Comment:
   Added this for better error handling - before it will segfault if the function cannot be found, now it raises error to user, e.g.
   ```
   >   raise ArrowKeyError(message)
   E   pyarrow.lib.ArrowKeyError: No function registered with name: my_udf
   E   /home/icexelloss/workspace/arrow/cpp/src/arrow/compute/exec/expression.cc:534  GetFunction(call, exec_context)
   E   /home/icexelloss/workspace/arrow/cpp/src/arrow/engine/substrait/relation_internal.cc:550  des_expr.Bind(*input.output_schema)
   E   /home/icexelloss/workspace/arrow/cpp/src/arrow/engine/substrait/serde.cc:157  FromProto(plan_rel.has_root() ? plan_rel.root().input() : plan_rel.rel(), ext_set, conversion_options)
   E   /home/icexelloss/workspace/arrow/cpp/src/arrow/engine/substrait/serde.cc:200  DeserializePlans(buf, MakeNoSinkDeclarationFactory(), registry, ext_set_out, conversion_options)
   E   /home/icexelloss/workspace/arrow/cpp/src/arrow/engine/substrait/util.cc:47  DeserializePlan(substrait_buffer, registry, nullptr, conversion_options)
   ```



-- 
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: github-unsubscribe@arrow.apache.org

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