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 2020/07/13 21:30:32 UTC

[GitHub] [arrow] wesm commented on a change in pull request #7272: ARROW-8314: [Python] Add a Table.select method to select a subset of columns

wesm commented on a change in pull request #7272:
URL: https://github.com/apache/arrow/pull/7272#discussion_r453944356



##########
File path: cpp/src/arrow/table.cc
##########
@@ -362,6 +362,23 @@ Result<std::shared_ptr<Table>> Table::RenameColumns(
   return Table::Make(::arrow::schema(std::move(fields)), std::move(columns), num_rows());
 }
 
+Result<std::shared_ptr<Table>> Table::SelectColumns(
+    const std::vector<int>& indices) const {
+  int n = static_cast<int>(indices.size());
+
+  std::vector<std::shared_ptr<ChunkedArray>> columns(n);
+  std::vector<std::shared_ptr<Field>> fields(n);
+  for (int i = 0; i < n; i++) {
+    int pos = indices[i];

Review comment:
       If this is returning `Result` anyway we might as well boundscheck the indices, thoughts?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org