MCPcopy Create free account
hub / github.com/apache/arrow / length

Method length

cpp/src/arrow/datum.cc:101–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101int64_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
118int64_t Datum::TotalBufferSize() const {
119 switch (this->kind()) {

Callers 15

test_lengthMethod · 0.45
test_sliceMethod · 0.45
test_chunkMethod · 0.45
test_flattenMethod · 0.45
test_write_tableMethod · 0.45
setupMethod · 0.45
test_valueMethod · 0.45
test_valuesMethod · 0.45

Calls 2

kindMethod · 0.45
num_rowsMethod · 0.45

Tested by 15

test_lengthMethod · 0.36
test_sliceMethod · 0.36
test_chunkMethod · 0.36
test_flattenMethod · 0.36
test_write_tableMethod · 0.36
setupMethod · 0.36
test_valueMethod · 0.36
test_valuesMethod · 0.36
test_value_offsetMethod · 0.36
test_value_lengthMethod · 0.36
test_validMethod · 0.36
test_invalidMethod · 0.36