westonpace commented on a change in pull request #12560:
URL: https://github.com/apache/arrow/pull/12560#discussion_r819804608



##########
File path: cpp/src/arrow/dataset/scanner.cc
##########
@@ -708,8 +709,12 @@ Result<ProjectionDescr> 
ProjectionDescr::FromNames(std::vector<std::string> name
   for (size_t i = 0; i < exprs.size(); ++i) {
     exprs[i] = compute::field_ref(names[i]);
   }
+  auto fields = dataset_schema.fields();
+  for (const auto& aug_field : kAugmentedFields) {
+    fields.push_back(aug_field);
+  }
   return ProjectionDescr::FromExpressions(std::move(exprs), std::move(names),
-                                          dataset_schema);
+                                          Schema(fields));

Review comment:
       Agreed about the docs update.  And, actually, now that I think about it, 
we probably want to make sure that these fields are not included in the 
"default" projection (e.g. if both `projected_schema` and `projection` are not 
specified) and we should probably have a test case verifying that these fields 
do not get returned.




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