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


##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -199,12 +217,22 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& 
rel, const ExtensionSet&
                                                  std::move(filesystem), 
std::move(files),
                                                  std::move(format), {}));
 
-      ARROW_ASSIGN_OR_RAISE(auto ds, 
ds_factory->Finish(std::move(base_schema)));
+      ARROW_ASSIGN_OR_RAISE(auto ds, ds_factory->Finish(base_schema));
 
-      return DeclarationInfo{
-          compute::Declaration{
-              "scan", dataset::ScanNodeOptions{std::move(ds), 
std::move(scan_options)}},
-          num_columns};
+      if (HasEmit(read)) {
+        ARROW_ASSIGN_OR_RAISE(auto emit_expressions, GetEmitInfo(read, 
base_schema));
+        return DeclarationInfo{
+            compute::Declaration::Sequence(
+                {{"scan",
+                  dataset::ScanNodeOptions{std::move(ds), 
std::move(scan_options)}},
+                 {"project", 
compute::ProjectNodeOptions{std::move(emit_expressions)}}}),
+            static_cast<int>(emit_expressions.size()), std::move(base_schema)};
+      } else {

Review Comment:
   There is a question about this, I think the `Rel` doesn't have the 
`emit_kind_case`, but the `RelCommon` does. 
   So first we need to see if `has_common()` returns true and then check the 
`common().emit_kind_case()`. But if `has_common()` returns false we have to 
return the `no_emit` declaration. Is this a wrong interpretation of things? 



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