You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2023/04/10 21:20:51 UTC

[arrow] branch main updated: MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit (#34777)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new a7c4e05ade MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit (#34777)
a7c4e05ade is described below

commit a7c4e05adee7a568710ad0f62198a9614c0c9594
Author: Li Jin <ic...@gmail.com>
AuthorDate: Mon Apr 10 17:20:43 2023 -0400

    MINOR: [C++] Remove std::move when calling ProcessEmit and ProcessExtensionEmit (#34777)
    
    ### Rationale for this change
    I noticed a few places in relation_internal.cc that std::move is used incorrectly.
    
    ### What changes are included in this PR?
    * Currently, `std::move` is used when passing arguments to `ProcessEmit` and `ProcessExtensionEmit`, however these two methods takes in const reference and therefore the `std::move` is not needed.
    * (orthogonal) Removed unneeded `FromProto` from header
    
    ### Are these changes tested?
    With existing tests
    
    ### Are there any user-facing changes?
    No
    
    Authored-by: Li Jin <ic...@gmail.com>
    Signed-off-by: Weston Pace <we...@gmail.com>
---
 .../arrow/engine/substrait/expression_internal.h   |  5 ----
 .../arrow/engine/substrait/relation_internal.cc    | 27 ++++++++--------------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/cpp/src/arrow/engine/substrait/expression_internal.h b/cpp/src/arrow/engine/substrait/expression_internal.h
index cddc46066f..2ce2ee76af 100644
--- a/cpp/src/arrow/engine/substrait/expression_internal.h
+++ b/cpp/src/arrow/engine/substrait/expression_internal.h
@@ -39,11 +39,6 @@ ARROW_ENGINE_EXPORT
 Result<FieldRef> DirectReferenceFromProto(const substrait::Expression::FieldReference*,
                                           const ExtensionSet&, const ConversionOptions&);
 
-ARROW_ENGINE_EXPORT
-Result<compute::Expression> FromProto(const substrait::Expression::FieldReference*,
-                                      const ExtensionSet&, const ConversionOptions&,
-                                      std::optional<compute::Expression>);
-
 ARROW_ENGINE_EXPORT
 Result<compute::Expression> FromProto(const substrait::Expression&, const ExtensionSet&,
                                       const ConversionOptions&);
diff --git a/cpp/src/arrow/engine/substrait/relation_internal.cc b/cpp/src/arrow/engine/substrait/relation_internal.cc
index d1a81d3eaf..e7d704554c 100644
--- a/cpp/src/arrow/engine/substrait/relation_internal.cc
+++ b/cpp/src/arrow/engine/substrait/relation_internal.cc
@@ -419,9 +419,8 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
           return Status::Invalid("Invalid NamedTable Source");
         }
 
-        return ProcessEmit(std::move(read),
-                           DeclarationInfo{std::move(source_decl), base_schema},
-                           std::move(base_schema));
+        return ProcessEmit(read, DeclarationInfo{std::move(source_decl), base_schema},
+                           base_schema);
       }
 
       if (!read.has_local_files()) {
@@ -567,8 +566,7 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
           acero::Declaration{"scan", dataset::ScanNodeOptions{ds, scan_options}},
           base_schema};
 
-      return ProcessEmit(std::move(read), std::move(scan_declaration),
-                         std::move(base_schema));
+      return ProcessEmit(read, scan_declaration, base_schema);
     }
 
     case substrait::Rel::RelTypeCase::kFilter: {
@@ -593,8 +591,7 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
           }),
           input.output_schema};
 
-      return ProcessEmit(std::move(filter), std::move(filter_declaration),
-                         input.output_schema);
+      return ProcessEmit(filter, filter_declaration, input.output_schema);
     }
 
     case substrait::Rel::RelTypeCase::kProject: {
@@ -647,8 +644,7 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
           }),
           project_schema};
 
-      return ProcessEmit(std::move(project), std::move(project_declaration),
-                         std::move(project_schema));
+      return ProcessEmit(project, project_declaration, project_schema);
     }
 
     case substrait::Rel::RelTypeCase::kJoin: {
@@ -754,8 +750,7 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
 
       DeclarationInfo join_declaration{std::move(join_dec), join_schema};
 
-      return ProcessEmit(std::move(join), std::move(join_declaration),
-                         std::move(join_schema));
+      return ProcessEmit(join, join_declaration, join_schema);
     }
     case substrait::Rel::RelTypeCase::kAggregate: {
       const auto& aggregate = rel.aggregate();
@@ -823,9 +818,8 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
               std::move(aggregates), std::move(agg_src_fieldsets), std::move(keys),
               std::move(key_field_ids), {}, {}, ext_set, conversion_options));
 
-      auto aggregate_schema = aggregate_declaration.output_schema;
-      return ProcessEmit(std::move(aggregate), std::move(aggregate_declaration),
-                         std::move(aggregate_schema));
+      return ProcessEmit(aggregate, aggregate_declaration,
+                         aggregate_declaration.output_schema);
     }
 
     case substrait::Rel::RelTypeCase::kExtensionLeaf:
@@ -869,7 +863,7 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
           emit_order.push_back(emit_idx);
         }
       }
-      return ProcessExtensionEmit(std::move(ext_decl_info), emit_order,
+      return ProcessExtensionEmit(ext_decl_info, emit_order,
                                   *ext_rel_info.field_output_indices);
     }
 
@@ -912,8 +906,7 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
       }
 
       auto set_declaration = DeclarationInfo{union_declr, union_schema};
-      return ProcessEmit(std::move(set), std::move(set_declaration),
-                         std::move(union_schema));
+      return ProcessEmit(set, set_declaration, union_schema);
     }
 
     default: