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

Function MakeDecoder

cpp/src/parquet/decoder.cc:2380–2456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2378// Factory functions
2379
2380std::unique_ptr<Decoder> MakeDecoder(Type::type type_num, Encoding::type encoding,
2381 const ColumnDescriptor* descr,
2382 ::arrow::MemoryPool* pool) {
2383 if (encoding == Encoding::PLAIN) {
2384 switch (type_num) {
2385 case Type::BOOLEAN:
2386 return std::make_unique<PlainBooleanDecoder>(descr);
2387 case Type::INT32:
2388 return std::make_unique<PlainDecoder<Int32Type>>(descr);
2389 case Type::INT64:
2390 return std::make_unique<PlainDecoder<Int64Type>>(descr);
2391 case Type::INT96:
2392 return std::make_unique<PlainDecoder<Int96Type>>(descr);
2393 case Type::FLOAT:
2394 return std::make_unique<PlainDecoder<FloatType>>(descr);
2395 case Type::DOUBLE:
2396 return std::make_unique<PlainDecoder<DoubleType>>(descr);
2397 case Type::BYTE_ARRAY:
2398 return std::make_unique<PlainByteArrayDecoder>(descr);
2399 case Type::FIXED_LEN_BYTE_ARRAY:
2400 return std::make_unique<PlainFLBADecoder>(descr);
2401 default:
2402 break;
2403 }
2404 } else if (encoding == Encoding::BYTE_STREAM_SPLIT) {
2405 switch (type_num) {
2406 case Type::INT32:
2407 return std::make_unique<ByteStreamSplitDecoder<Int32Type>>(descr);
2408 case Type::INT64:
2409 return std::make_unique<ByteStreamSplitDecoder<Int64Type>>(descr);
2410 case Type::FLOAT:
2411 return std::make_unique<ByteStreamSplitDecoder<FloatType>>(descr);
2412 case Type::DOUBLE:
2413 return std::make_unique<ByteStreamSplitDecoder<DoubleType>>(descr);
2414 case Type::FIXED_LEN_BYTE_ARRAY:
2415 return std::make_unique<ByteStreamSplitDecoder<FLBAType>>(descr);
2416 default:
2417 throw ParquetException(
2418 "BYTE_STREAM_SPLIT only supports FLOAT, DOUBLE, INT32, INT64 "
2419 "and FIXED_LEN_BYTE_ARRAY");
2420 }
2421 } else if (encoding == Encoding::DELTA_BINARY_PACKED) {
2422 switch (type_num) {
2423 case Type::INT32:
2424 return std::make_unique<DeltaBitPackDecoder<Int32Type>>(descr, pool);
2425 case Type::INT64:
2426 return std::make_unique<DeltaBitPackDecoder<Int64Type>>(descr, pool);
2427 default:
2428 throw ParquetException(
2429 "DELTA_BINARY_PACKED decoder only supports INT32 and INT64");
2430 }
2431 } else if (encoding == Encoding::DELTA_BYTE_ARRAY) {
2432 switch (type_num) {
2433 case Type::BYTE_ARRAY:
2434 return std::make_unique<DeltaByteArrayDecoder>(descr, pool);
2435 case Type::FIXED_LEN_BYTE_ARRAY:
2436 return std::make_unique<DeltaByteArrayFLBADecoder>(descr, pool);
2437 default:

Callers 14

TESTFunction · 0.70
MakeTypedDecoderFunction · 0.70
TestNullTypeMethod · 0.50
TestOtherTypeMethod · 0.50
TestThreadedMethod · 0.50
TestIntegersMethod · 0.50
TestOptionsMethod · 0.50
TestErrorsMethod · 0.50
TestThreadedMethod · 0.50
TestIntegersMethod · 0.50
TestThreadedMethod · 0.50
TestOptionsMethod · 0.50

Calls 2

ParquetExceptionFunction · 0.85
NYIFunction · 0.85

Tested by 13

TESTFunction · 0.56
TestNullTypeMethod · 0.40
TestOtherTypeMethod · 0.40
TestThreadedMethod · 0.40
TestIntegersMethod · 0.40
TestOptionsMethod · 0.40
TestErrorsMethod · 0.40
TestThreadedMethod · 0.40
TestIntegersMethod · 0.40
TestThreadedMethod · 0.40
TestOptionsMethod · 0.40
TestErrorsMethod · 0.40