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

Method Encode

cpp/src/parquet/column_writer.cc:217–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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