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 2022/11/15 06:04:57 UTC

[GitHub] [arrow] westonpace commented on a diff in pull request #14186: ARROW-17520: [C++] Implement SubStrait SetRel (UnionAll)

westonpace commented on code in PR #14186:
URL: https://github.com/apache/arrow/pull/14186#discussion_r1022350402


##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -619,6 +620,49 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& rel, const ExtensionSet&
                          std::move(aggregate_schema));
     }
 
+    case substrait::Rel::RelTypeCase::kSet: {
+      const auto& set = rel.set();
+      RETURN_NOT_OK(CheckRelCommon(set, conversion_options));
+
+      if (set.inputs_size() < 2) {
+        return Status::Invalid(
+            "substrait::SetRel with inadequate number of input relations, ",
+            set.inputs_size());
+      }
+      substrait::SetRel_SetOp op = set.op();
+      // Note: at the moment Acero only supports UNION_ALL operation
+      switch (op) {
+        case substrait::SetRel::SET_OP_UNSPECIFIED:
+        case substrait::SetRel::SET_OP_MINUS_PRIMARY:
+        case substrait::SetRel::SET_OP_MINUS_MULTISET:
+        case substrait::SetRel::SET_OP_INTERSECTION_PRIMARY:
+        case substrait::SetRel::SET_OP_INTERSECTION_MULTISET:
+        case substrait::SetRel::SET_OP_UNION_DISTINCT:
+          return Status::NotImplemented(
+              "NotImplemented union type : ",
+              EnumToString(op, substrait::SetRel_SetOp_descriptor()));
+        case substrait::SetRel::SET_OP_UNION_ALL:
+          break;
+        default:
+          return Status::Invalid("Unsupported union type");

Review Comment:
   ```suggestion
             return Status::Invalid("Unknown union type");
   ```



##########
cpp/src/arrow/engine/substrait/util.h:
##########
@@ -25,6 +25,8 @@
 #include "arrow/engine/substrait/options.h"
 #include "arrow/util/iterator.h"
 
+#include "substrait/algebra.pb.h"  // IWYU pragma: export

Review Comment:
   Unfortunately, we can't do this.  I made the same mistake playing around with extension rels.  However, this is part of the public API (these methods are used by python).
   
   I agree it would be useful to have this method in a common spot.  Can you make a `util_internal.h`  for this?



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