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

Method GetColumnIndex

cpp/src/parquet/page_index.cc:232–270  ·  view source on GitHub ↗

Read column index of a column chunk.

Source from the content-addressed store, hash-verified

230
231 /// Read column index of a column chunk.
232 std::shared_ptr<ColumnIndex> GetColumnIndex(int32_t i) override {
233 if (i < 0 || i >= row_group_metadata_->num_columns()) {
234 throw ParquetException("Invalid column index at column ordinal ", i);
235 }
236
237 auto col_chunk = row_group_metadata_->ColumnChunk(i);
238 auto column_index_location = col_chunk->GetColumnIndexLocation();
239 if (!column_index_location.has_value()) {
240 return nullptr;
241 }
242
243 CheckReadRangeOrThrow(*column_index_location, index_read_range_.column_index,
244 row_group_ordinal_);
245
246 if (column_index_buffer_ == nullptr) {
247 column_index_buffer_ =
248 ReadIndexBuffer(index_read_range_.column_index->offset,
249 index_read_range_.column_index->length, "ColumnIndex");
250 }
251
252 int64_t buffer_offset =
253 column_index_location->offset - index_read_range_.column_index->offset;
254 // ColumnIndex::Make() requires the type of serialized thrift message to be
255 // uint32_t
256 uint32_t length = static_cast<uint32_t>(column_index_location->length);
257 auto descr = row_group_metadata_->schema()->Column(i);
258
259 // Get decryptor of column index if encrypted.
260 std::unique_ptr<Decryptor> decryptor =
261 InternalFileDecryptor::GetColumnMetaDecryptorFactory(
262 file_decryptor_, col_chunk->crypto_metadata().get())();
263 if (decryptor != nullptr) {
264 UpdateDecryptor(decryptor.get(), row_group_ordinal_, /*column_ordinal=*/i,
265 encryption::kColumnIndex);
266 }
267
268 return ColumnIndex::Make(*descr, column_index_buffer_->data() + buffer_offset, length,
269 properties_, decryptor.get());
270 }
271
272 /// Read offset index of a column chunk.
273 std::shared_ptr<OffsetIndex> GetOffsetIndex(int32_t i) override {

Callers

nothing calls this directly

Calls 11

ParquetExceptionFunction · 0.85
UpdateDecryptorFunction · 0.85
MakeFunction · 0.70
num_columnsMethod · 0.45
ColumnChunkMethod · 0.45
ColumnMethod · 0.45
schemaMethod · 0.45
getMethod · 0.45
crypto_metadataMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected