| 638 | } |
| 639 | |
| 640 | Result<ArrayDataVector> CreateColumns(ArrayDataVector columns, |
| 641 | bool resolve_dictionaries = true) { |
| 642 | if (resolve_dictionaries) { |
| 643 | // Dictionary resolution needs to happen on the unfiltered columns, |
| 644 | // because fields are mapped structurally (by path in the original schema). |
| 645 | RETURN_NOT_OK(ResolveDictionaries(columns, *context_.dictionary_memo, |
| 646 | context_.options.memory_pool)); |
| 647 | } |
| 648 | |
| 649 | ArrayDataVector filtered_columns; |
| 650 | if (!inclusion_mask_.empty()) { |
| 651 | FieldVector filtered_fields; |
| 652 | for (int i = 0; i < schema_->num_fields(); ++i) { |
| 653 | if (inclusion_mask_[i]) { |
| 654 | DCHECK_NE(columns[i], nullptr); |
| 655 | filtered_columns.push_back(std::move(columns[i])); |
| 656 | } |
| 657 | } |
| 658 | columns.clear(); |
| 659 | } else { |
| 660 | filtered_columns = std::move(columns); |
| 661 | } |
| 662 | |
| 663 | if (context_.compression != Compression::UNCOMPRESSED) { |
| 664 | RETURN_NOT_OK( |
| 665 | DecompressBuffers(context_.compression, context_.options, &filtered_columns)); |
| 666 | } |
| 667 | |
| 668 | // Swap endian if necessary |
| 669 | if (context_.swap_endian) { |
| 670 | for (auto& column : filtered_columns) { |
| 671 | ARROW_ASSIGN_OR_RAISE( |
| 672 | column, arrow::internal::SwapEndianArrayData(std::move(column), |
| 673 | context_.options.memory_pool)); |
| 674 | } |
| 675 | } |
| 676 | if (context_.options.ensure_alignment != Alignment::kAnyAlignment) { |
| 677 | for (auto& column : filtered_columns) { |
| 678 | ARROW_ASSIGN_OR_RAISE( |
| 679 | column, |
| 680 | util::EnsureAlignment( |
| 681 | std::move(column), |
| 682 | // The numerical value of the enum is taken literally as byte alignment |
| 683 | static_cast<int64_t>(context_.options.ensure_alignment), |
| 684 | context_.options.memory_pool)); |
| 685 | } |
| 686 | } |
| 687 | return filtered_columns; |
| 688 | } |
| 689 | |
| 690 | IpcReadContext context_; |
| 691 | std::shared_ptr<Schema> schema_; |
nothing calls this directly
no test coverage detected