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

Function Reserve

cpp/src/arrow/array/builder_base.h:138–146  ·  view source on GitHub ↗

\brief Ensure that there is enough space allocated to append the indicated number of elements without any further reallocation. Overallocation is used in order to minimize the impact of incremental Reserve() calls. Note that additional_capacity is relative to the current number of elements rather than to the current capacity, so calls to Reserve() which are not interspersed with addition of new el

Source from the content-addressed store, hash-verified

136 /// \param[in] additional_capacity the number of additional array values
137 /// \return Status
138 Status Reserve(int64_t additional_capacity) {
139 auto current_capacity = capacity();
140 auto min_capacity = length() + additional_capacity;
141 if (min_capacity <= current_capacity) return Status::OK();
142
143 // leave growth factor up to BufferBuilder
144 auto new_capacity = BufferBuilder::GrowByFactor(current_capacity, min_capacity);
145 return Resize(new_capacity);
146 }
147
148 /// Reset the builder.
149 virtual void Reset();

Callers 15

AppendMethod · 0.70
AppendNullsMethod · 0.70
AppendNullMethod · 0.70
AppendEmptyValueMethod · 0.70
AppendEmptyValuesMethod · 0.70
AppendValuesMethod · 0.70
AppendValuesFunction · 0.70
AppendNullsFunction · 0.70
AppendNullFunction · 0.70
AppendEmptyValueFunction · 0.70
AppendEmptyValuesFunction · 0.70
AppendFunction · 0.70

Calls 5

GrowByFactorFunction · 0.85
capacityFunction · 0.70
lengthFunction · 0.70
ResizeFunction · 0.70
OKFunction · 0.50

Tested by

no test coverage detected