in cpp-ch/local-engine/Storages/ch_parquet/arrow/encoding.cc [3292:3356]
std::unique_ptr<Decoder> MakeDecoder(Type::type type_num, Encoding::type encoding,
const ColumnDescriptor* descr) {
if (encoding == Encoding::PLAIN) {
switch (type_num) {
case Type::BOOLEAN:
return std::make_unique<PlainBooleanDecoder>(descr);
case Type::INT32:
return std::make_unique<PlainDecoder<Int32Type>>(descr);
case Type::INT64:
return std::make_unique<PlainDecoder<Int64Type>>(descr);
case Type::INT96:
return std::make_unique<PlainDecoder<Int96Type>>(descr);
case Type::FLOAT:
return std::make_unique<PlainDecoder<FloatType>>(descr);
case Type::DOUBLE:
return std::make_unique<PlainDecoder<DoubleType>>(descr);
case Type::BYTE_ARRAY:
return std::make_unique<PlainByteArrayDecoder>(descr);
case Type::FIXED_LEN_BYTE_ARRAY:
return std::make_unique<PlainFLBADecoder>(descr);
default:
break;
}
} else if (encoding == Encoding::BYTE_STREAM_SPLIT) {
switch (type_num) {
case Type::FLOAT:
return std::make_unique<ByteStreamSplitDecoder<FloatType>>(descr);
case Type::DOUBLE:
return std::make_unique<ByteStreamSplitDecoder<DoubleType>>(descr);
default:
throw ParquetException("BYTE_STREAM_SPLIT only supports FLOAT and DOUBLE");
break;
}
} else if (encoding == Encoding::DELTA_BINARY_PACKED) {
switch (type_num) {
case Type::INT32:
return std::make_unique<DeltaBitPackDecoder<Int32Type>>(descr);
case Type::INT64:
return std::make_unique<DeltaBitPackDecoder<Int64Type>>(descr);
default:
throw ParquetException(
"DELTA_BINARY_PACKED decoder only supports INT32 and INT64");
break;
}
} else if (encoding == Encoding::DELTA_BYTE_ARRAY) {
if (type_num == Type::BYTE_ARRAY) {
return std::make_unique<DeltaByteArrayDecoder>(descr);
}
throw ParquetException("DELTA_BYTE_ARRAY only supports BYTE_ARRAY");
} else if (encoding == Encoding::DELTA_LENGTH_BYTE_ARRAY) {
if (type_num == Type::BYTE_ARRAY) {
return std::make_unique<DeltaLengthByteArrayDecoder>(descr);
}
throw ParquetException("DELTA_LENGTH_BYTE_ARRAY only supports BYTE_ARRAY");
} else if (encoding == Encoding::RLE) {
if (type_num == Type::BOOLEAN) {
return std::make_unique<RleBooleanDecoder>(descr);
}
throw ParquetException("RLE encoding only supports BOOLEAN");
} else {
ParquetException::NYI("Selected encoding is not supported");
}
DCHECK(false) << "Should not be able to reach this code";
return nullptr;
}