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


##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -541,6 +541,52 @@ 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));
+
+      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:
+          return Status::NotImplemented("NotImplemented union type");
+        case substrait::SetRel::SET_OP_MINUS_PRIMARY:
+          return Status::NotImplemented("NotImplemented union type");
+        case substrait::SetRel::SET_OP_MINUS_MULTISET:
+          return Status::NotImplemented("NotImplemented union type");
+        case substrait::SetRel::SET_OP_INTERSECTION_PRIMARY:
+          return Status::NotImplemented("NotImplemented union type");
+        case substrait::SetRel::SET_OP_INTERSECTION_MULTISET:
+          return Status::NotImplemented("NotImplemented union type");
+        case substrait::SetRel::SET_OP_UNION_DISTINCT:
+          return Status::NotImplemented("NotImplemented union type");
+        case substrait::SetRel::SET_OP_UNION_ALL:
+          break;
+        default:
+          return Status::Invalid("Unsupported union type");
+      }
+      int input_size = set.inputs_size();
+      compute::Declaration union_declr{"union", compute::ExecNodeOptions{}};
+      std::shared_ptr<Schema> union_schema;
+      for (int input_id = 0; input_id < input_size; input_id++) {
+        ARROW_ASSIGN_OR_RAISE(
+            auto input, FromProto(set.inputs(input_id), ext_set, 
conversion_options));
+        union_declr.inputs.emplace_back(std::move(input.declaration));
+        if (union_schema == nullptr) {
+          union_schema = input.output_schema;

Review Comment:
   Is there a better way? 
   
   cc @westonpace 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to