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

Function MakeEncoder

cpp/src/parquet/encoder.cc:1769–1870  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1767// Factory function
1768
1769std::unique_ptr<Encoder> MakeEncoder(Type::type type_num, Encoding::type encoding,
1770 bool use_dictionary, const ColumnDescriptor* descr,
1771 MemoryPool* pool) {
1772 if (use_dictionary) {
1773 switch (type_num) {
1774 case Type::INT32:
1775 return std::make_unique<DictEncoderImpl<Int32Type>>(descr, pool);
1776 case Type::INT64:
1777 return std::make_unique<DictEncoderImpl<Int64Type>>(descr, pool);
1778 case Type::INT96:
1779 return std::make_unique<DictEncoderImpl<Int96Type>>(descr, pool);
1780 case Type::FLOAT:
1781 return std::make_unique<DictEncoderImpl<FloatType>>(descr, pool);
1782 case Type::DOUBLE:
1783 return std::make_unique<DictEncoderImpl<DoubleType>>(descr, pool);
1784 case Type::BYTE_ARRAY:
1785 return std::make_unique<DictEncoderImpl<ByteArrayType>>(descr, pool);
1786 case Type::FIXED_LEN_BYTE_ARRAY:
1787 return std::make_unique<DictEncoderImpl<FLBAType>>(descr, pool);
1788 default:
1789 DCHECK(false) << "Encoder not implemented";
1790 break;
1791 }
1792 } else if (encoding == Encoding::PLAIN) {
1793 switch (type_num) {
1794 case Type::BOOLEAN:
1795 return std::make_unique<PlainEncoder<BooleanType>>(descr, pool);
1796 case Type::INT32:
1797 return std::make_unique<PlainEncoder<Int32Type>>(descr, pool);
1798 case Type::INT64:
1799 return std::make_unique<PlainEncoder<Int64Type>>(descr, pool);
1800 case Type::INT96:
1801 return std::make_unique<PlainEncoder<Int96Type>>(descr, pool);
1802 case Type::FLOAT:
1803 return std::make_unique<PlainEncoder<FloatType>>(descr, pool);
1804 case Type::DOUBLE:
1805 return std::make_unique<PlainEncoder<DoubleType>>(descr, pool);
1806 case Type::BYTE_ARRAY:
1807 return std::make_unique<PlainEncoder<ByteArrayType>>(descr, pool);
1808 case Type::FIXED_LEN_BYTE_ARRAY:
1809 return std::make_unique<PlainEncoder<FLBAType>>(descr, pool);
1810 default:
1811 DCHECK(false) << "Encoder not implemented";
1812 break;
1813 }
1814 } else if (encoding == Encoding::BYTE_STREAM_SPLIT) {
1815 switch (type_num) {
1816 case Type::INT32:
1817 return std::make_unique<ByteStreamSplitEncoder<Int32Type>>(descr, pool);
1818 case Type::INT64:
1819 return std::make_unique<ByteStreamSplitEncoder<Int64Type>>(descr, pool);
1820 case Type::FLOAT:
1821 return std::make_unique<ByteStreamSplitEncoder<FloatType>>(descr, pool);
1822 case Type::DOUBLE:
1823 return std::make_unique<ByteStreamSplitEncoder<DoubleType>>(descr, pool);
1824 case Type::FIXED_LEN_BYTE_ARRAY:
1825 return std::make_unique<ByteStreamSplitEncoder<FLBAType>>(descr, pool);
1826 default:

Callers 12

TESTFunction · 0.70
CheckRoundtripMethod · 0.70
MakeTypedEncoderFunction · 0.70
BM_PlainEncodingBooleanFunction · 0.70
BM_PlainDecodingBooleanFunction · 0.70
BM_RleEncodingBooleanFunction · 0.70
BM_RleDecodingBooleanFunction · 0.70
EncodeDictFunction · 0.70
DecodeDictFunction · 0.70
TypedColumnWriterImplMethod · 0.70

Calls 2

ParquetExceptionFunction · 0.85
NYIFunction · 0.85

Tested by 2

TESTFunction · 0.56
CheckRoundtripMethod · 0.56