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

Function MakeEncoder

cpp/src/parquet/encoder.cc:1767–1868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 15

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

Calls 2

ParquetExceptionFunction · 0.85
NYIFunction · 0.85

Tested by 2

TESTFunction · 0.68
CheckRoundtripMethod · 0.68