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

Method TranslateColPaths

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

Source from the content-addressed store, hash-verified

387}
388
389void OrcSchemaResolver::TranslateColPaths(const SchemaPath& col_path,
390 SchemaPath* table_col_path, SchemaPath* file_col_path) const {
391 DCHECK(!col_path.empty());
392 DCHECK(table_col_path != nullptr);
393 DCHECK(file_col_path != nullptr);
394 table_col_path->reserve(col_path.size() + 1);
395 file_col_path->reserve(col_path.size() + 1);
396 int first_idx = col_path[0];
397 int num_part_cols = tbl_desc_.num_clustering_cols();
398 int remaining_idx = 0;
399 if (!is_table_full_acid_) {
400 // Table is not full ACID. Only need to adjust partitioning columns.
401 table_col_path->push_back(first_idx);
402 file_col_path->push_back(first_idx - num_part_cols);
403 remaining_idx = 1;
404 } else if (is_file_full_acid_) {
405 DCHECK(is_table_full_acid_);
406 // Table is full ACID, and file is in full ACID format too. We need to do some
407 // conversions since the Frontend table schema and file schema differs. See the
408 // comment at the declaration of this function.
409 if (first_idx == num_part_cols + ACID_FIELD_ROW) {
410 // 'first_idx' refers to "row" column. Table definition doesn't have "row" column.
411 table_col_path->push_back(-1);
412 file_col_path->push_back(first_idx - num_part_cols);
413 if (col_path.size() == 1 ) return;
414 int second_idx = col_path[1];
415 // Adjust table with num partitioning colums and the synthetic 'row__id' column.
416 table_col_path->push_back(num_part_cols + 1 + second_idx);
417 file_col_path->push_back(second_idx);
418 } else {
419 DCHECK_GE(first_idx, num_part_cols) << "col_path: " << PrintNumericPath(col_path);
420 // 'col_path' refers to the ACID columns. In table schema they are nested
421 // under the synthetic 'row__id' column. 'row__id' is at index 'num_part_cols'.
422 table_col_path->push_back(num_part_cols);
423 file_col_path->push_back(-1);
424 // The ACID column is under 'row__id' at index 'table_idx - num_part_cols'.
425 int acid_col_idx = first_idx - num_part_cols;
426 table_col_path->push_back(acid_col_idx);
427 file_col_path->push_back(acid_col_idx);
428 }
429 remaining_idx = 2;
430 } else if (!is_file_full_acid_) {
431 DCHECK(is_table_full_acid_);
432 // Table is full ACID, but file is in non-ACID format.
433 if (first_idx == num_part_cols + ACID_FIELD_ROW) {
434 if (col_path.size() == 1 ) return;
435 // 'first_idx' refers to "row" column. Table definition doesn't have "row" column,
436 // but neither the file schema here. We don't include it in the output paths.
437 int second_idx = col_path[1];
438 // Adjust table with num partitioning colums and the synthetic 'row__id' column.
439 table_col_path->push_back(num_part_cols + 1 + second_idx);
440 file_col_path->push_back(second_idx);
441 } else {
442 DCHECK_GE(first_idx, num_part_cols) << "col_path: " << PrintNumericPath(col_path);
443 // 'col_path' refers to the ACID columns. In table schema they are nested
444 // under the synthetic 'row__id' column. 'row__id' is at index 'num_part_cols'.
445 table_col_path->push_back(num_part_cols);
446 file_col_path->push_back(-1);

Callers 1

PrintColPathFunction · 0.80

Calls 7

PrintNumericPathFunction · 0.85
maxFunction · 0.85
reserveMethod · 0.80
num_clustering_colsMethod · 0.80
push_backMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected