westonpace commented on code in PR #34406:
URL: https://github.com/apache/arrow/pull/34406#discussion_r1127121989
##########
cpp/src/arrow/compute/exec/options.h:
##########
@@ -614,6 +616,13 @@ class ARROW_EXPORT TableSinkNodeOptions : public
ExecNodeOptions {
///
/// \see QueryOptions for more details
std::optional<bool> sequence_output;
+ /// \brief Custom names to use for the columns.
+ ///
+ /// If specified then names must be provided for all fields. Currently, only
a flat
+ /// schema is supported (see ARROW-15901).
Review Comment:
Ah, ARROW-15901 was the wrong issue anyways. I've updated these to point to
the correct GH- issue.
##########
cpp/src/arrow/compute/exec/exec_plan.cc:
##########
@@ -925,14 +943,32 @@ struct BatchConverter {
});
}
+ Result<std::shared_ptr<Schema>> InitializeSchema(
+ const std::vector<std::string>& names) {
+ // By this point this->schema will have been set by the SinkNode. We
potentially
+ // rename it with the names provided by the user and then return this in
case the user
+ // wants to know the output schema.
+ if (!names.empty()) {
+ if (static_cast<int>(names.size()) != schema->num_fields()) {
+ return Status::Invalid(
+ "A plan was created with custom field names but the number of
names did not "
+ "match the number of output columns");
Review Comment:
Done.
--
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]