You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by GitBox <gi...@apache.org> on 2023/01/02 23:06:40 UTC

[GitHub] [arrow] ava6969 opened a new issue, #15161: Inplace renaming of columns in c++ record batch.

ava6969 opened a new issue, #15161:
URL: https://github.com/apache/arrow/issues/15161

   ### Describe the usage question you have. Please include as many useful details as  possible.
   
   
   I would love to rename the columns of record batch without creation of the record batch. Is that possible?
   
   I tried this without no success.
   
   record_batch = record_batch->ReplaceSchemaMetadata(std::make_shared<arrow::KeyValueMetadata>(new_columns));
   
   ### Component(s)
   
   C++


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

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


[GitHub] [arrow] westonpace commented on issue #15161: [C++] Inplace renaming of columns in c++ record batch.

Posted by GitBox <gi...@apache.org>.
westonpace commented on issue #15161:
URL: https://github.com/apache/arrow/issues/15161#issuecomment-1376574396

   > I don't see this function in the record batch
   
   Correct, one does not exist.  I was suggesting that someone create one.  If you create one yourself I'd encourage you to submit a PR.
   
   > in what instance, is there a copy of the buffer.
   
   Normally you have to go out of your way to copy a buffer.  For example, create an array builder, add all the values from the old array, and then build an array from that.
   
   However, many of the compute functions (take, filter, sort, cast, etc.) will do this (some casts are zero-copy but not all).


-- 
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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] ava6969 commented on issue #15161: [C++] Inplace renaming of columns in c++ record batch.

Posted by GitBox <gi...@apache.org>.
ava6969 commented on issue #15161:
URL: https://github.com/apache/arrow/issues/15161#issuecomment-1371541694

   I don't see this function in the record batch but i guess i can perform this operation myself. in what instance, is there a copy of the buffer.


-- 
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: github-unsubscribe@arrow.apache.org

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


[GitHub] [arrow] westonpace commented on issue #15161: [C++] Inplace renaming of columns in c++ record batch.

Posted by GitBox <gi...@apache.org>.
westonpace commented on issue #15161:
URL: https://github.com/apache/arrow/issues/15161#issuecomment-1371329080

   There is `arrow::Table::RenameColumns` and I would be in favor of a similar `arrow::RecordBatch::RenameColumns`.  However, this would still be creating a new record batch.
   
   In Arrow-C++ classes such as `Array`, `RecordBatch`, `ChunkedArray`, and `Table` are immutable.  Changing this constraint would be pretty significant and is unlikely.  However, creating a new `RecordBatch` should be cheap because we do not copy the underlying buffers.  The cost should simply be a few `shared_ptr` allocations (possibly per column).


-- 
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: github-unsubscribe@arrow.apache.org

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