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

Function DispatchArrowBinaryHelper

cpp/src/parquet/decoder.cc:232–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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