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

Method Encode

cpp/src/parquet/column_writer.cc:218–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218int LevelEncoder::Encode(int batch_size, const int16_t* levels) {
219 int num_encoded = 0;
220 if (!rle_encoder_ && !bit_packed_encoder_) {
221 throw ParquetException("Level encoders are not initialized.");
222 }
223
224 if (encoding_ == Encoding::RLE) {
225 for (int i = 0; i < batch_size; ++i) {
226 if (!rle_encoder_->Put(*(levels + i))) {
227 break;
228 }
229 ++num_encoded;
230 }
231 rle_encoder_->Flush();
232 rle_length_ = rle_encoder_->len();
233 } else {
234 for (int i = 0; i < batch_size; ++i) {
235 if (!bit_packed_encoder_->PutValue(*(levels + i), bit_width_)) {
236 break;
237 }
238 ++num_encoded;
239 }
240 bit_packed_encoder_->Flush();
241 }
242 return num_encoded;
243}
244
245// ----------------------------------------------------------------------
246// PageWriter implementation

Callers 15

EncodeLevelsFunction · 0.45
TESTFunction · 0.45
EncodeLevelsFunction · 0.45
MergeDistinctCountMethod · 0.45
TestMergeMinMaxMethod · 0.45
TestMergeNullCountMethod · 0.45
TestMissingNullCountMethod · 0.45
AppendLevelsMethod · 0.45
BM_ReadColumnIndexFunction · 0.45
BM_RleEncodingFunction · 0.45

Calls 5

ParquetExceptionFunction · 0.85
PutValueMethod · 0.80
PutMethod · 0.45
FlushMethod · 0.45
lenMethod · 0.45

Tested by 9

EncodeLevelsFunction · 0.36
TESTFunction · 0.36
MergeDistinctCountMethod · 0.36
TestMergeMinMaxMethod · 0.36
TestMergeNullCountMethod · 0.36
TestMissingNullCountMethod · 0.36
AppendLevelsMethod · 0.36