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 2021/10/25 21:13:20 UTC

[GitHub] [arrow] westonpace commented on a change in pull request #11441: ARROW-14355: [C++] Create naive implementation of algorithm to estimate table/batch buffer size

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



##########
File path: cpp/src/arrow/datum.cc
##########
@@ -128,6 +129,25 @@ int64_t Datum::length() const {
   }
 }
 
+int64_t Datum::TotalBufferSize() const {
+  switch (this->kind()) {
+    case Datum::ARRAY:
+      return util::TotalBufferSize(*util::get<std::shared_ptr<ArrayData>>(this->value));
+    case Datum::CHUNKED_ARRAY:
+      return util::TotalBufferSize(
+          *util::get<std::shared_ptr<ChunkedArray>>(this->value));
+    case Datum::RECORD_BATCH:
+      return util::TotalBufferSize(*util::get<std::shared_ptr<RecordBatch>>(this->value));
+    case Datum::TABLE:
+      return util::TotalBufferSize(*util::get<std::shared_ptr<Table>>(this->value));
+    case Datum::SCALAR:
+      return 0;

Review comment:
       Yeah, I'd rather defer until someone has a need for it.  At the moment the wrapper metadata (e.g. ExecBatch, etc.) is likely to be larger than the scalar itself.




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