This is an automated email from the ASF dual-hosted git repository.

westonpace pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 44eb26072b ARROW-16796: [C++] Fix bad defaulting of ExecContext 
argument (#13355)
44eb26072b is described below

commit 44eb26072be7864a0c5673afaa1ea71e360a9f06
Author: rtpsw <[email protected]>
AuthorDate: Fri Jun 10 23:40:55 2022 +0300

    ARROW-16796: [C++] Fix bad defaulting of ExecContext argument (#13355)
    
    See https://issues.apache.org/jira/browse/ARROW-16796
    
    Authored-by: Yaron Gvili <[email protected]>
    Signed-off-by: Weston Pace <[email protected]>
---
 cpp/src/arrow/compute/exec/filter_node.cc    |  3 ++-
 cpp/src/arrow/compute/exec/hash_join.h       |  2 +-
 cpp/src/arrow/compute/exec/hash_join_node.cc | 11 ++++++-----
 cpp/src/arrow/compute/exec/project_node.cc   |  3 ++-
 4 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/cpp/src/arrow/compute/exec/filter_node.cc 
b/cpp/src/arrow/compute/exec/filter_node.cc
index 0c849cb043..b424da35f8 100644
--- a/cpp/src/arrow/compute/exec/filter_node.cc
+++ b/cpp/src/arrow/compute/exec/filter_node.cc
@@ -50,7 +50,8 @@ class FilterNode : public MapNode {
 
     auto filter_expression = filter_options.filter_expression;
     if (!filter_expression.IsBound()) {
-      ARROW_ASSIGN_OR_RAISE(filter_expression, 
filter_expression.Bind(*schema));
+      ARROW_ASSIGN_OR_RAISE(filter_expression,
+                            filter_expression.Bind(*schema, 
plan->exec_context()));
     }
 
     if (filter_expression.type()->id() != Type::BOOL) {
diff --git a/cpp/src/arrow/compute/exec/hash_join.h 
b/cpp/src/arrow/compute/exec/hash_join.h
index 9739cbc643..84685989a1 100644
--- a/cpp/src/arrow/compute/exec/hash_join.h
+++ b/cpp/src/arrow/compute/exec/hash_join.h
@@ -59,7 +59,7 @@ class ARROW_EXPORT HashJoinSchema {
                                 const std::string& right_field_name_prefix);
 
   Result<Expression> BindFilter(Expression filter, const Schema& left_schema,
-                                const Schema& right_schema);
+                                const Schema& right_schema, ExecContext* 
exec_context);
   std::shared_ptr<Schema> MakeOutputSchema(const std::string& 
left_field_name_suffix,
                                            const std::string& 
right_field_name_suffix);
 
diff --git a/cpp/src/arrow/compute/exec/hash_join_node.cc 
b/cpp/src/arrow/compute/exec/hash_join_node.cc
index c9232c6e43..8ea6883b55 100644
--- a/cpp/src/arrow/compute/exec/hash_join_node.cc
+++ b/cpp/src/arrow/compute/exec/hash_join_node.cc
@@ -336,7 +336,8 @@ std::shared_ptr<Schema> HashJoinSchema::MakeOutputSchema(
 
 Result<Expression> HashJoinSchema::BindFilter(Expression filter,
                                               const Schema& left_schema,
-                                              const Schema& right_schema) {
+                                              const Schema& right_schema,
+                                              ExecContext* exec_context) {
   if (filter.IsBound() || filter == literal(true)) {
     return std::move(filter);
   }
@@ -367,7 +368,7 @@ Result<Expression> HashJoinSchema::BindFilter(Expression 
filter,
                                           filter);
 
   // Step 3: Bind
-  ARROW_ASSIGN_OR_RAISE(filter, filter.Bind(filter_schema));
+  ARROW_ASSIGN_OR_RAISE(filter, filter.Bind(filter_schema, exec_context));
   if (filter.type()->id() != Type::BOOL) {
     return Status::TypeError("Filter expression must evaluate to bool, but ",
                              filter.ToString(), " evaluates to ",
@@ -514,9 +515,9 @@ class HashJoinNode : public ExecNode {
           join_options.output_suffix_for_left, 
join_options.output_suffix_for_right));
     }
 
-    ARROW_ASSIGN_OR_RAISE(
-        Expression filter,
-        schema_mgr->BindFilter(join_options.filter, left_schema, 
right_schema));
+    ARROW_ASSIGN_OR_RAISE(Expression filter,
+                          schema_mgr->BindFilter(join_options.filter, 
left_schema,
+                                                 right_schema, 
plan->exec_context()));
 
     // Generate output schema
     std::shared_ptr<Schema> output_schema = schema_mgr->MakeOutputSchema(
diff --git a/cpp/src/arrow/compute/exec/project_node.cc 
b/cpp/src/arrow/compute/exec/project_node.cc
index b8fb64c5d5..cad8d7c45a 100644
--- a/cpp/src/arrow/compute/exec/project_node.cc
+++ b/cpp/src/arrow/compute/exec/project_node.cc
@@ -64,7 +64,8 @@ class ProjectNode : public MapNode {
     int i = 0;
     for (auto& expr : exprs) {
       if (!expr.IsBound()) {
-        ARROW_ASSIGN_OR_RAISE(expr, expr.Bind(*inputs[0]->output_schema()));
+        ARROW_ASSIGN_OR_RAISE(
+            expr, expr.Bind(*inputs[0]->output_schema(), 
plan->exec_context()));
       }
       fields[i] = field(std::move(names[i]), expr.type());
       ++i;

Reply via email to