pitrou commented on a change in pull request #12175:
URL: https://github.com/apache/arrow/pull/12175#discussion_r787699385



##########
File path: r/src/chunkedarray.cpp
##########
@@ -143,4 +144,10 @@ std::shared_ptr<arrow::ChunkedArray> 
ChunkedArray__from_list(cpp11::list chunks,
   return std::make_shared<arrow::ChunkedArray>(std::move(vec));
 }
 
+// [[arrow::export]]
+int64_t ChunkedArray__ReferencedBufferSize(const 
std::shared_ptr<arrow::ChunkedArray>& x) {
+  auto chunked_array = arrow::internal::checked_cast<const 
arrow::ChunkedArray*>(x.get());

Review comment:
       Same here.

##########
File path: r/src/recordbatch.cpp
##########
@@ -305,4 +307,10 @@ std::shared_ptr<arrow::RecordBatch> 
RecordBatch__from_arrays(SEXP schema_sxp, SE
   return arrow::RecordBatch::Make(schema, num_rows, arrays);
 }
 
+// [[arrow::export]]
+int64_t RecordBatch__ReferencedBufferSize(const 
std::shared_ptr<arrow::RecordBatch>& x) {
+  auto batch = arrow::internal::checked_cast<const 
arrow::RecordBatch*>(x.get());

Review comment:
       Here too.

##########
File path: r/src/array.cpp
##########
@@ -288,4 +289,10 @@ bool Array__Same(const std::shared_ptr<arrow::Array>& x,
                  const std::shared_ptr<arrow::Array>& y) {
   return x.get() == y.get();
 }
+
+// [[arrow::export]]
+int64_t Array__ReferencedBufferSize(const std::shared_ptr<arrow::Array>& x) {
+  auto array = arrow::internal::checked_cast<const arrow::Array*>(x.get());
+  return ValueOrStop(arrow::util::ReferencedBufferSize(*array));

Review comment:
       The checked_cast is pointless here, the type is the same left and right.
   ```suggestion
     return ValueOrStop(arrow::util::ReferencedBufferSize(*x));
   ```

##########
File path: r/src/table.cpp
##########
@@ -21,6 +21,7 @@
 #include <arrow/array/array_base.h>
 #include <arrow/table.h>
 #include <arrow/util/key_value_metadata.h>
+#include <arrow/util/byte_size.h>

Review comment:
       Alphebetical ordering here too.

##########
File path: r/src/recordbatch.cpp
##########
@@ -25,6 +25,8 @@
 #include <arrow/ipc/writer.h>
 #include <arrow/type.h>
 #include <arrow/util/key_value_metadata.h>
+#include <arrow/util/byte_size.h>

Review comment:
       Can you keep these includes alphabetically-ordered?

##########
File path: r/src/table.cpp
##########
@@ -283,4 +284,10 @@ std::shared_ptr<arrow::Table> Table__from_record_batches(
   return tab;
 }
 
+// [[arrow::export]]
+int64_t Table__ReferencedBufferSize(const std::shared_ptr<arrow::Table>& x) {
+  auto table = arrow::internal::checked_cast<const arrow::Table*>(x.get());

Review comment:
       Casting here too.




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