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

Method Init

cpp/src/parquet/column_writer.cc:169–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167LevelEncoder::~LevelEncoder() {}
168
169void LevelEncoder::Init(Encoding::type encoding, int16_t max_level,
170 int num_buffered_values, uint8_t* data, int data_size) {
171 bit_width_ = bit_util::Log2(max_level + 1);
172 encoding_ = encoding;
173 switch (encoding) {
174 case Encoding::RLE: {
175 rle_encoder_ = std::make_unique<RleBitPackedEncoder>(data, data_size, bit_width_);
176 break;
177 }
178 case Encoding::BIT_PACKED: {
179 int num_bytes =
180 static_cast<int>(bit_util::BytesForBits(num_buffered_values * bit_width_));
181 bit_packed_encoder_ = std::make_unique<BitWriter>(data, num_bytes);
182 break;
183 }
184 default:
185 throw ParquetException("Unknown encoding type for levels.");
186 }
187}
188
189int LevelEncoder::MaxBufferSize(Encoding::type encoding, int16_t max_level,
190 int num_buffered_values) {

Callers 1

RleEncodeLevelsMethod · 0.45

Calls 3

BytesForBitsFunction · 0.85
ParquetExceptionFunction · 0.85
Log2Function · 0.50

Tested by

no test coverage detected