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

Function DirectPutImpl

cpp/src/parquet/encoder.cc:217–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215
216template <typename ArrayType>
217void DirectPutImpl(const ::arrow::Array& values, ::arrow::BufferBuilder* sink) {
218 if (values.type_id() != ArrayType::TypeClass::type_id) {
219 std::string type_name = ArrayType::TypeClass::type_name();
220 throw ParquetException("direct put to " + type_name + " from " +
221 values.type()->ToString() + " not supported");
222 }
223
224 using value_type = typename ArrayType::value_type;
225 constexpr auto value_size = sizeof(value_type);
226 auto raw_values = checked_cast<const ArrayType&>(values).raw_values();
227
228 if (values.null_count() == 0) {
229 // no nulls, just dump the data
230 PARQUET_THROW_NOT_OK(sink->Append(raw_values, values.length() * value_size));
231 } else {
232 PARQUET_THROW_NOT_OK(
233 sink->Reserve((values.length() - values.null_count()) * value_size));
234
235 for (int64_t i = 0; i < values.length(); i++) {
236 if (values.IsValid(i)) {
237 sink->UnsafeAppend(&raw_values[i], value_size);
238 }
239 }
240 }
241}
242
243template <>
244void PlainEncoder<Int32Type>::Put(const ::arrow::Array& values) {

Callers

nothing calls this directly

Calls 12

ParquetExceptionFunction · 0.85
type_nameFunction · 0.50
type_idMethod · 0.45
ToStringMethod · 0.45
typeMethod · 0.45
raw_valuesMethod · 0.45
null_countMethod · 0.45
AppendMethod · 0.45
lengthMethod · 0.45
ReserveMethod · 0.45
IsValidMethod · 0.45
UnsafeAppendMethod · 0.45

Tested by

no test coverage detected