MCPcopy Create free account
hub / github.com/apache/impala / GenerateFieldIDs

Method GenerateFieldIDs

be/src/exec/orc/orc-metadata-utils.cc:330–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328}
329
330Status OrcSchemaResolver::GenerateFieldIDs() {
331 std::stack<const orc::Type*> nodes;
332
333 nodes.push(root_);
334
335 int fieldID = 1;
336
337 while (!nodes.empty()) {
338 const orc::Type* current = nodes.top();
339 nodes.pop();
340
341 uint64_t size = current->getSubtypeCount();
342
343 for (uint64_t i = 0; i < size; i++) {
344 auto retval = orc_type_to_field_id_.emplace(current->getSubtype(i), fieldID++);
345
346 // Emplace has to be successful, otherwise we visited the same node twice
347 DCHECK(retval.second);
348
349 // Push children in reverse order to the stack so they are processed in the original
350 // order
351 const orc::Type* reverseOrderChild = current->getSubtype(size - i - 1);
352 if (reverseOrderChild->getSubtypeCount() > 0) {
353 nodes.push(reverseOrderChild);
354 }
355 }
356
357 if (current == root_ && !nodes.empty()) {
358 // Partition columns are not stored in file metadata, but they get field IDs
359 // from Iceberg. Check if there are partition columns and adjust field ID
360 // generation. It is only relevant for tables that have complex types.
361 RETURN_IF_ERROR(
362 file_metadata_utils_.AdjustFieldIdForMigratedPartitionedTables(&fieldID));
363 }
364 }
365 return Status::OK();
366}
367
368int OrcSchemaResolver::GetGeneratedFieldID(const orc::Type* type) const {
369 auto it = orc_type_to_field_id_.find(type);

Callers

nothing calls this directly

Calls 5

OKFunction · 0.85
pushMethod · 0.80
emptyMethod · 0.45
topMethod · 0.45

Tested by

no test coverage detected