| 99 | } |
| 100 | |
| 101 | int64_t Datum::length() const { |
| 102 | switch (this->kind()) { |
| 103 | case Datum::ARRAY: |
| 104 | return std::get<std::shared_ptr<ArrayData>>(this->value)->length; |
| 105 | case Datum::CHUNKED_ARRAY: |
| 106 | return std::get<std::shared_ptr<ChunkedArray>>(this->value)->length(); |
| 107 | case Datum::RECORD_BATCH: |
| 108 | return std::get<std::shared_ptr<RecordBatch>>(this->value)->num_rows(); |
| 109 | case Datum::TABLE: |
| 110 | return std::get<std::shared_ptr<Table>>(this->value)->num_rows(); |
| 111 | case Datum::SCALAR: |
| 112 | return 1; |
| 113 | default: |
| 114 | return kUnknownLength; |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | int64_t Datum::TotalBufferSize() const { |
| 119 | switch (this->kind()) { |