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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to