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

Function DispatchArrowBinaryHelper

cpp/src/parquet/decoder.cc:233–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231// suitable for the Parquet DType and accumulator `acc`.
232template <typename DType, typename Function, typename... Args>
233auto DispatchArrowBinaryHelper(typename EncodingTraits<DType>::Accumulator* acc,
234 int64_t length,
235 std::optional<int64_t> estimated_data_length,
236 Function&& func, Args&&... args) {
237 static_assert(std::is_same_v<DType, ByteArrayType> || std::is_same_v<DType, FLBAType>,
238 "unsupported DType");
239 if constexpr (std::is_same_v<DType, ByteArrayType>) {
240 switch (acc->builder->type()->id()) {
241 case ::arrow::Type::BINARY:
242 case ::arrow::Type::STRING: {
243 ArrowBinaryHelper<DType, ::arrow::BinaryType> helper(acc);
244 RETURN_NOT_OK(helper.Prepare(length, estimated_data_length));
245 return func(&helper, std::forward<Args>(args)...);
246 }
247 case ::arrow::Type::LARGE_BINARY:
248 case ::arrow::Type::LARGE_STRING: {
249 ArrowBinaryHelper<DType, ::arrow::LargeBinaryType> helper(acc);
250 RETURN_NOT_OK(helper.Prepare(length, estimated_data_length));
251 return func(&helper, std::forward<Args>(args)...);
252 }
253 case ::arrow::Type::BINARY_VIEW:
254 case ::arrow::Type::STRING_VIEW: {
255 ArrowBinaryHelper<DType, ::arrow::BinaryViewType> helper(acc);
256 RETURN_NOT_OK(helper.Prepare(length, estimated_data_length));
257 return func(&helper, std::forward<Args>(args)...);
258 }
259 default:
260 throw ParquetException(
261 "Unsupported Arrow builder type when reading from BYTE_ARRAY column: " +
262 acc->builder->type()->ToString());
263 }
264 } else {
265 ArrowBinaryHelper<DType, ::arrow::FixedSizeBinaryType> helper(acc);
266 RETURN_NOT_OK(helper.Prepare(length, estimated_data_length));
267 return func(&helper, std::forward<Args>(args)...);
268 }
269}
270
271void CheckPageLargeEnough(int64_t remaining_bytes, int32_t value_width,
272 int64_t num_values) {

Callers

nothing calls this directly

Calls 6

ParquetExceptionFunction · 0.85
funcFunction · 0.50
idMethod · 0.45
typeMethod · 0.45
PrepareMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected