| 678 | } |
| 679 | |
| 680 | Block MergeTreeBaseSelectProcessor::transformHeader( |
| 681 | Block block, const PrewhereInfoPtr & prewhere_info, const DataTypePtr & partition_value_type, const Names & virtual_columns, const MergeTreeIndexContextPtr & index_context_, bool read_bitmap_index) |
| 682 | { |
| 683 | auto * bitmap_index_info = index_context_ ? dynamic_cast<BitmapIndexInfo *>(index_context_->get(MergeTreeIndexInfo::Type::BITMAP).get()) : nullptr; |
| 684 | if (bitmap_index_info) |
| 685 | { |
| 686 | if (auto projection_index_action = index_context_->getProjectionActions(false); projection_index_action && read_bitmap_index) |
| 687 | { |
| 688 | auto projection_index_expression = std::make_shared<ExpressionActions>(projection_index_action); |
| 689 | projection_index_expression->execute(block); |
| 690 | } |
| 691 | block = bitmap_index_info->updateHeader(std::move(block)); |
| 692 | } |
| 693 | if (prewhere_info) |
| 694 | { |
| 695 | if (prewhere_info->alias_actions) |
| 696 | block = prewhere_info->alias_actions->updateHeader(std::move(block)); |
| 697 | |
| 698 | if (prewhere_info->row_level_filter) |
| 699 | { |
| 700 | block = prewhere_info->row_level_filter->updateHeader(std::move(block)); |
| 701 | auto & row_level_column = block.getByName(prewhere_info->row_level_column_name); |
| 702 | if (!row_level_column.type->canBeUsedInBooleanContext()) |
| 703 | { |
| 704 | throw Exception("Invalid type for filter in PREWHERE: " + row_level_column.type->getName(), |
| 705 | ErrorCodes::LOGICAL_ERROR); |
| 706 | } |
| 707 | |
| 708 | block.erase(prewhere_info->row_level_column_name); |
| 709 | } |
| 710 | |
| 711 | if (prewhere_info->prewhere_actions) |
| 712 | block = prewhere_info->prewhere_actions->updateHeader(std::move(block)); |
| 713 | |
| 714 | auto & prewhere_column = block.getByName(prewhere_info->prewhere_column_name); |
| 715 | if (!prewhere_column.type->canBeUsedInBooleanContext()) |
| 716 | { |
| 717 | throw Exception("Invalid type for filter in PREWHERE: " + prewhere_column.type->getName(), |
| 718 | ErrorCodes::LOGICAL_ERROR); |
| 719 | } |
| 720 | |
| 721 | if (prewhere_info->remove_prewhere_column) |
| 722 | block.erase(prewhere_info->prewhere_column_name); |
| 723 | else |
| 724 | { |
| 725 | WhichDataType which(removeNullable(recursiveRemoveLowCardinality(prewhere_column.type))); |
| 726 | if (which.isInt() || which.isUInt()) |
| 727 | prewhere_column.column = prewhere_column.type->createColumnConst(block.rows(), 1u)->convertToFullColumnIfConst(); |
| 728 | else if (which.isFloat()) |
| 729 | prewhere_column.column = prewhere_column.type->createColumnConst(block.rows(), 1.0f)->convertToFullColumnIfConst(); |
| 730 | else |
| 731 | throw Exception("Illegal type " + prewhere_column.type->getName() + " of column for filter.", |
| 732 | ErrorCodes::ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER); |
| 733 | } |
| 734 | } |
| 735 | |
| 736 | injectVirtualColumns(block, nullptr, partition_value_type, virtual_columns); |
| 737 | return block; |
nothing calls this directly
no test coverage detected